diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f81bf992..8305d4ab 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.31.0" + ".": "0.31.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c3bd48c4..ba169181 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 0.31.1 (2025-02-17) + +Full Changelog: [v0.31.0...v0.31.1](https://github.com/orbcorp/orb-java/compare/v0.31.0...v0.31.1) + +### Bug Fixes + +* format webhooks ([143457b](https://github.com/orbcorp/orb-java/commit/143457bb6f9d9953def62bddc78e09ad6f42c158)) + + +### Chores + +* **internal:** make body class constructors private ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255)) +* **internal:** make body classes for multipart requests ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255)) +* **internal:** misc formatting changes ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255)) +* **internal:** optimize build and test perf ([be128e3](https://github.com/orbcorp/orb-java/commit/be128e35f2113a4e96a1c52171cc83cfe66bce74)) +* **internal:** rename internal body classes ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255)) +* **internal:** update formatter ([#247](https://github.com/orbcorp/orb-java/issues/247)) ([be128e3](https://github.com/orbcorp/orb-java/commit/be128e35f2113a4e96a1c52171cc83cfe66bce74)) +* **internal:** use better test example values ([#249](https://github.com/orbcorp/orb-java/issues/249)) ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255)) + ## 0.31.0 (2025-02-14) Full Changelog: [v0.30.0...v0.31.0](https://github.com/orbcorp/orb-java/compare/v0.30.0...v0.31.0) diff --git a/README.md b/README.md index 46a71c55..81fbb139 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.31.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.31.1) @@ -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.31.0") +implementation("com.withorb.api:orb-java:0.31.1") ``` ### Maven @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.31.0") com.withorb.api orb-java - 0.31.0 + 0.31.1 ``` diff --git a/build.gradle.kts b/build.gradle.kts index da315962..3e67483f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.withorb.api" - version = "0.31.0" // x-release-please-version + version = "0.31.1" // x-release-please-version } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 8a1d7a10..d1ed374d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,6 +1,6 @@ plugins { `kotlin-dsl` - kotlin("jvm") version "2.1.0" + kotlin("jvm") version "2.1.10" id("com.vanniktech.maven.publish") version "0.28.0" } @@ -10,7 +10,7 @@ repositories { } dependencies { - implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23") + implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10") implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0") } diff --git a/buildSrc/src/main/kotlin/orb.java.gradle.kts b/buildSrc/src/main/kotlin/orb.java.gradle.kts index a2c35b93..597b6e80 100644 --- a/buildSrc/src/main/kotlin/orb.java.gradle.kts +++ b/buildSrc/src/main/kotlin/orb.java.gradle.kts @@ -39,9 +39,13 @@ tasks.named("jar") { } } -tasks.named("test") { +tasks.withType().configureEach { useJUnitPlatform() + // Run tests in parallel to some degree. + maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) + forkEvery = 100 + testLogging { exceptionFormat = TestExceptionFormat.FULL } diff --git a/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts b/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts index 882c3a5c..1cf56f97 100644 --- a/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts @@ -1,4 +1,5 @@ import com.diffplug.gradle.spotless.SpotlessExtension +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -20,13 +21,19 @@ configure { } tasks.withType().configureEach { - kotlinOptions { + compilerOptions { freeCompilerArgs = listOf( "-Xjvm-default=all", "-Xjdk-release=1.8", // Suppress deprecation warnings because we may still reference and test deprecated members. "-Xsuppress-warning=DEPRECATION" ) - jvmTarget = "1.8" + jvmTarget.set(JvmTarget.JVM_1_8) } } + +// Run tests in parallel to some degree. +tasks.withType().configureEach { + maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) + forkEvery = 100 +} diff --git a/gradle.properties b/gradle.properties index a3bc58f2..ec5c5092 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,6 @@ +org.gradle.configuration-cache=true org.gradle.caching=true -org.gradle.jvmargs=-Xmx4g org.gradle.parallel=true +org.gradle.daemon=false +org.gradle.jvmargs=-Xmx4g kotlin.daemon.jvmargs=-Xmx4g diff --git a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt index e1b18a40..7cdd0e02 100644 --- a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt +++ b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt @@ -31,10 +31,7 @@ class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) : HttpClient { - override fun execute( - request: HttpRequest, - requestOptions: RequestOptions, - ): HttpResponse { + override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse { val call = newCall(request, requestOptions) return try { @@ -120,13 +117,13 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val ) { builder.header( "X-Stainless-Read-Timeout", - Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString() + Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(), ) } if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) { builder.header( "X-Stainless-Timeout", - Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString() + Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt index 71cadda5..6f8eadd5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt @@ -33,9 +33,7 @@ import com.withorb.api.services.async.SubscriptionServiceAsyncImpl import com.withorb.api.services.async.TopLevelServiceAsync import com.withorb.api.services.async.TopLevelServiceAsyncImpl -class OrbClientAsyncImpl( - private val clientOptions: ClientOptions, -) : OrbClientAsync { +class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAsync { private val clientOptionsWithUserAgent = if (clientOptions.headers.names().contains("User-Agent")) clientOptions diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt index adf67509..46d45ebf 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt @@ -35,9 +35,7 @@ import com.withorb.api.services.blocking.TopLevelServiceImpl import com.withorb.api.services.blocking.WebhookService import com.withorb.api.services.blocking.WebhookServiceImpl -class OrbClientImpl( - private val clientOptions: ClientOptions, -) : OrbClient { +class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient { private val clientOptionsWithUserAgent = if (clientOptions.headers.names().contains("User-Agent")) clientOptions diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/BaseDeserializer.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/BaseDeserializer.kt index 6466a647..4fc63b4d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/BaseDeserializer.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/BaseDeserializer.kt @@ -18,7 +18,7 @@ abstract class BaseDeserializer(type: KClass) : override fun createContextual( context: DeserializationContext, - property: BeanProperty? + property: BeanProperty?, ): JsonDeserializer { return this } @@ -32,7 +32,7 @@ abstract class BaseDeserializer(type: KClass) : protected fun ObjectCodec.tryDeserialize( node: JsonNode, type: TypeReference, - validate: (T) -> Unit = {} + validate: (T) -> Unit = {}, ): T? { return try { readValue(treeAsTokens(node), type).apply(validate) @@ -46,7 +46,7 @@ abstract class BaseDeserializer(type: KClass) : protected fun ObjectCodec.tryDeserialize( node: JsonNode, type: JavaType, - validate: (T) -> Unit = {} + validate: (T) -> Unit = {}, ): T? { return try { readValue(treeAsTokens(node), type).apply(validate) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/HttpRequestBodies.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/HttpRequestBodies.kt index 2e22b229..020e8646 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/HttpRequestBodies.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/HttpRequestBodies.kt @@ -10,10 +10,7 @@ import java.io.OutputStream import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder @JvmSynthetic -internal inline fun json( - jsonMapper: JsonMapper, - value: T, -): HttpRequestBody { +internal inline fun json(jsonMapper: JsonMapper, value: T): HttpRequestBody { return object : HttpRequestBody { private var cachedBytes: ByteArray? = null @@ -49,7 +46,7 @@ internal inline fun json( @JvmSynthetic internal fun multipartFormData( jsonMapper: JsonMapper, - parts: Array?> + parts: Array?>, ): HttpRequestBody { val builder = MultipartEntityBuilder.create() parts.forEach { part -> @@ -66,14 +63,14 @@ internal fun multipartFormData( part.name, buffer.toByteArray(), part.contentType, - part.filename + part.filename, ) } is Boolean -> builder.addTextBody( part.name, if (part.value) "true" else "false", - part.contentType + part.contentType, ) is Int -> builder.addTextBody(part.name, part.value.toString(), part.contentType) is Long -> builder.addTextBody(part.name, part.value.toString(), part.contentType) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/PrepareRequest.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/PrepareRequest.kt index 1a4592ad..e0c2972b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/PrepareRequest.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/PrepareRequest.kt @@ -17,7 +17,7 @@ internal fun HttpRequest.prepare(clientOptions: ClientOptions, params: Params): @JvmSynthetic internal fun HttpRequest.prepareAsync( clientOptions: ClientOptions, - params: Params + params: Params, ): CompletableFuture = // This async version exists to make it easier to add async specific preparation logic in the // future. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/RequestOptions.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/RequestOptions.kt index 5d9b4401..c1c6b76b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/RequestOptions.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/RequestOptions.kt @@ -2,11 +2,7 @@ package com.withorb.api.core import java.time.Duration -class RequestOptions -private constructor( - val responseValidation: Boolean?, - val timeout: Duration?, -) { +class RequestOptions private constructor(val responseValidation: Boolean?, val timeout: Duration?) { fun applyDefaults(options: RequestOptions): RequestOptions { return RequestOptions( responseValidation = this.responseValidation ?: options.responseValidation, diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/Values.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/Values.kt index 3a9629d0..0fbd67e0 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/Values.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/Values.kt @@ -287,7 +287,7 @@ class JsonMissing : JsonValue() { override fun serialize( value: JsonMissing, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { throw RuntimeException("JsonMissing cannot be serialized") } @@ -422,10 +422,7 @@ private constructor( } @JacksonAnnotationsInside -@JsonInclude( - JsonInclude.Include.CUSTOM, - valueFilter = JsonField.IsMissing::class, -) +@JsonInclude(JsonInclude.Include.CUSTOM, valueFilter = JsonField.IsMissing::class) annotation class ExcludeMissing @JacksonAnnotationsInside @@ -434,7 +431,7 @@ annotation class ExcludeMissing isGetterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, creatorVisibility = Visibility.NONE, - fieldVisibility = Visibility.NONE + fieldVisibility = Visibility.NONE, ) annotation class NoAutoDetect @@ -443,7 +440,7 @@ internal constructor( val name: String, val value: T, val contentType: ContentType, - val filename: String? = null + val filename: String? = null, ) { private var hashCode: Int = 0 @@ -462,7 +459,7 @@ internal constructor( is Long -> value is Double -> value else -> value?.hashCode() - } + }, ) } return hashCode @@ -496,7 +493,7 @@ internal constructor( internal fun fromString( name: String, value: String, - contentType: ContentType + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromBoolean( @@ -520,14 +517,14 @@ internal constructor( internal fun fromEnum( name: String, value: T, - contentType: ContentType + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromByteArray( name: String, value: ByteArray, contentType: ContentType, - filename: String? = null + filename: String? = null, ): MultipartFormValue = MultipartFormValue(name, value, contentType, filename) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/Headers.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/Headers.kt index 8bec2dde..47369c39 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/Headers.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/Headers.kt @@ -6,7 +6,7 @@ import java.util.TreeMap class Headers private constructor( private val map: Map>, - @get:JvmName("size") val size: Int + @get:JvmName("size") val size: Int, ) { fun isEmpty(): Boolean = map.isEmpty() @@ -74,7 +74,7 @@ private constructor( values.toImmutable() } .toImmutable(), - size + size, ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingHttpClient.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingHttpClient.kt index ced0ee65..7e5760a9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingHttpClient.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingHttpClient.kt @@ -19,7 +19,7 @@ internal class PhantomReachableClosingHttpClient(private val httpClient: HttpCli override fun executeAsync( request: HttpRequest, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture = httpClient.executeAsync(request, requestOptions) override fun close() = httpClient.close() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/QueryParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/QueryParams.kt index b09686de..87109b2b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/QueryParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/QueryParams.kt @@ -5,7 +5,7 @@ import com.withorb.api.core.toImmutable class QueryParams private constructor( private val map: Map>, - @get:JvmName("size") val size: Int + @get:JvmName("size") val size: Int, ) { fun isEmpty(): Boolean = map.isEmpty() 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 ba6f4dda..93413092 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 @@ -28,10 +28,7 @@ private constructor( private val idempotencyHeader: String?, ) : HttpClient { - override fun execute( - request: HttpRequest, - requestOptions: RequestOptions, - ): HttpResponse { + override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse { if (!isRetryable(request) || maxRetries <= 0) { return httpClient.execute(request, requestOptions) } @@ -100,7 +97,7 @@ private constructor( .handleAsync( fun( response: HttpResponse?, - throwable: Throwable? + throwable: Throwable?, ): CompletableFuture { if (response != null) { if (++retries > maxRetries || !shouldRetry(response)) { @@ -120,7 +117,7 @@ private constructor( return sleepAsync(backoffMillis.toMillis()).thenCompose { executeWithRetries(requestWithRetryCount, requestOptions) } - }, + } ) { // Run in the same thread. it.run() @@ -200,8 +197,8 @@ private constructor( OffsetDateTime.now(clock), OffsetDateTime.parse( retryAfter, - DateTimeFormatter.RFC_1123_DATE_TIME - ) + DateTimeFormatter.RFC_1123_DATE_TIME, + ), ) } catch (e: DateTimeParseException) { null @@ -239,7 +236,7 @@ private constructor( future.complete(null) } }, - millis + millis, ) return future } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/BadRequestException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/BadRequestException.kt index 30513518..08d6372d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/BadRequestException.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/BadRequestException.kt @@ -2,8 +2,5 @@ package com.withorb.api.errors import com.withorb.api.core.http.Headers -class BadRequestException( - headers: Headers, - body: String, - error: OrbError, -) : OrbServiceException(400, headers, body, error) +class BadRequestException(headers: Headers, body: String, error: OrbError) : + OrbServiceException(400, headers, body, error) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/InternalServerException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/InternalServerException.kt index c8acf740..3913e5ec 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/InternalServerException.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/InternalServerException.kt @@ -2,9 +2,5 @@ package com.withorb.api.errors import com.withorb.api.core.http.Headers -class InternalServerException( - statusCode: Int, - headers: Headers, - body: String, - error: OrbError, -) : OrbServiceException(statusCode, headers, body, error) +class InternalServerException(statusCode: Int, headers: Headers, body: String, error: OrbError) : + OrbServiceException(statusCode, headers, body, error) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/NotFoundException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/NotFoundException.kt index 8e4f6cb4..ae91d72d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/NotFoundException.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/NotFoundException.kt @@ -2,8 +2,5 @@ package com.withorb.api.errors import com.withorb.api.core.http.Headers -class NotFoundException( - headers: Headers, - body: String, - error: OrbError, -) : OrbServiceException(404, headers, body, error) +class NotFoundException(headers: Headers, body: String, error: OrbError) : + OrbServiceException(404, headers, body, error) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbError.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbError.kt index 172a304f..2479f3e0 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbError.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbError.kt @@ -20,7 +20,7 @@ private constructor( @ExcludeMissing @JsonAnySetter @get:JvmName("additionalProperties") - val additionalProperties: Map = immutableEmptyMap(), + val additionalProperties: Map = immutableEmptyMap() ) { fun toBuilder() = Builder().from(this) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbServiceException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbServiceException.kt index 2eafb822..c386c79c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbServiceException.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbServiceException.kt @@ -10,7 +10,7 @@ constructor( private val body: String, private val error: OrbError, message: String = "$statusCode: $error", - cause: Throwable? = null + cause: Throwable? = null, ) : OrbException(message, cause) { fun statusCode(): Int = statusCode diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/PermissionDeniedException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/PermissionDeniedException.kt index b5d97fd4..176d1734 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/PermissionDeniedException.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/PermissionDeniedException.kt @@ -2,8 +2,5 @@ package com.withorb.api.errors import com.withorb.api.core.http.Headers -class PermissionDeniedException( - headers: Headers, - body: String, - error: OrbError, -) : OrbServiceException(403, headers, body, error) +class PermissionDeniedException(headers: Headers, body: String, error: OrbError) : + OrbServiceException(403, headers, body, error) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/RateLimitException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/RateLimitException.kt index cbfd0f5d..f76f50cc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/RateLimitException.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/RateLimitException.kt @@ -2,8 +2,5 @@ package com.withorb.api.errors import com.withorb.api.core.http.Headers -class RateLimitException( - headers: Headers, - body: String, - error: OrbError, -) : OrbServiceException(429, headers, body, error) +class RateLimitException(headers: Headers, body: String, error: OrbError) : + OrbServiceException(429, headers, body, error) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnauthorizedException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnauthorizedException.kt index 916c60ef..a561c505 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnauthorizedException.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnauthorizedException.kt @@ -2,8 +2,5 @@ package com.withorb.api.errors import com.withorb.api.core.http.Headers -class UnauthorizedException( - headers: Headers, - body: String, - error: OrbError, -) : OrbServiceException(401, headers, body, error) +class UnauthorizedException(headers: Headers, body: String, error: OrbError) : + OrbServiceException(401, headers, body, error) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnprocessableEntityException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnprocessableEntityException.kt index 818e9ad7..6f23fd97 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnprocessableEntityException.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnprocessableEntityException.kt @@ -2,8 +2,5 @@ package com.withorb.api.errors import com.withorb.api.core.http.Headers -class UnprocessableEntityException( - headers: Headers, - body: String, - error: OrbError, -) : OrbServiceException(422, headers, body, error) +class UnprocessableEntityException(headers: Headers, body: String, error: OrbError) : + OrbServiceException(422, headers, body, error) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt index 321ab11e..34a42c19 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt @@ -922,11 +922,7 @@ private constructor( } /** The type of alert. This must be a valid alert type. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 17954d4a..52e896b7 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,7 +33,7 @@ import java.util.Optional class AlertCreateForCustomerParams private constructor( private val customerId: String, - private val body: AlertCreateForCustomerBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -64,7 +64,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): AlertCreateForCustomerBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -78,9 +78,9 @@ private constructor( } @NoAutoDetect - class AlertCreateForCustomerBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -119,7 +119,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AlertCreateForCustomerBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -137,7 +137,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AlertCreateForCustomerBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var currency: JsonField? = null @@ -146,12 +146,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(alertCreateForCustomerBody: AlertCreateForCustomerBody) = apply { - currency = alertCreateForCustomerBody.currency - type = alertCreateForCustomerBody.type - thresholds = alertCreateForCustomerBody.thresholds.map { it.toMutableList() } - additionalProperties = - alertCreateForCustomerBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + currency = body.currency + type = body.type + thresholds = body.thresholds.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() } /** The case sensitive currency or custom pricing unit to use for this alert. */ @@ -212,8 +211,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): AlertCreateForCustomerBody = - AlertCreateForCustomerBody( + fun build(): Body = + Body( checkRequired("currency", currency), checkRequired("type", type), (thresholds ?: JsonMissing.of()).map { it.toImmutable() }, @@ -226,7 +225,7 @@ private constructor( return true } - return /* spotless:off */ other is AlertCreateForCustomerBody && currency == other.currency && type == other.type && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && currency == other.currency && type == other.type && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -236,7 +235,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AlertCreateForCustomerBody{currency=$currency, type=$type, thresholds=$thresholds, additionalProperties=$additionalProperties}" + "Body{currency=$currency, type=$type, thresholds=$thresholds, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -251,7 +250,7 @@ private constructor( class Builder internal constructor() { private var customerId: String? = null - private var body: AlertCreateForCustomerBody.Builder = AlertCreateForCustomerBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -418,11 +417,7 @@ private constructor( } /** The type of alert to create. This must be a valid alert type. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 a5cd29b0..99e52af4 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,7 +33,7 @@ import java.util.Optional class AlertCreateForExternalCustomerParams private constructor( private val externalCustomerId: String, - private val body: AlertCreateForExternalCustomerBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -64,7 +64,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): AlertCreateForExternalCustomerBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -78,9 +78,9 @@ private constructor( } @NoAutoDetect - class AlertCreateForExternalCustomerBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -119,7 +119,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AlertCreateForExternalCustomerBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -137,7 +137,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AlertCreateForExternalCustomerBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var currency: JsonField? = null @@ -146,15 +146,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - alertCreateForExternalCustomerBody: AlertCreateForExternalCustomerBody - ) = apply { - currency = alertCreateForExternalCustomerBody.currency - type = alertCreateForExternalCustomerBody.type - thresholds = - alertCreateForExternalCustomerBody.thresholds.map { it.toMutableList() } - additionalProperties = - alertCreateForExternalCustomerBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + currency = body.currency + type = body.type + thresholds = body.thresholds.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() } /** The case sensitive currency or custom pricing unit to use for this alert. */ @@ -215,8 +211,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): AlertCreateForExternalCustomerBody = - AlertCreateForExternalCustomerBody( + fun build(): Body = + Body( checkRequired("currency", currency), checkRequired("type", type), (thresholds ?: JsonMissing.of()).map { it.toImmutable() }, @@ -229,7 +225,7 @@ private constructor( return true } - return /* spotless:off */ other is AlertCreateForExternalCustomerBody && currency == other.currency && type == other.type && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && currency == other.currency && type == other.type && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -239,7 +235,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AlertCreateForExternalCustomerBody{currency=$currency, type=$type, thresholds=$thresholds, additionalProperties=$additionalProperties}" + "Body{currency=$currency, type=$type, thresholds=$thresholds, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -254,8 +250,7 @@ private constructor( class Builder internal constructor() { private var externalCustomerId: String? = null - private var body: AlertCreateForExternalCustomerBody.Builder = - AlertCreateForExternalCustomerBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -427,11 +422,7 @@ private constructor( } /** The type of alert to create. This must be a valid alert type. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 fc8eb74d..fd02cd33 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,7 +37,7 @@ import java.util.Optional class AlertCreateForSubscriptionParams private constructor( private val subscriptionId: String, - private val body: AlertCreateForSubscriptionBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -68,7 +68,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): AlertCreateForSubscriptionBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -82,9 +82,9 @@ private constructor( } @NoAutoDetect - class AlertCreateForSubscriptionBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("thresholds") @ExcludeMissing private val thresholds: JsonField> = JsonMissing.of(), @@ -122,7 +122,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AlertCreateForSubscriptionBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -140,7 +140,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AlertCreateForSubscriptionBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var thresholds: JsonField>? = null @@ -149,15 +149,12 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(alertCreateForSubscriptionBody: AlertCreateForSubscriptionBody) = - apply { - thresholds = - alertCreateForSubscriptionBody.thresholds.map { it.toMutableList() } - type = alertCreateForSubscriptionBody.type - metricId = alertCreateForSubscriptionBody.metricId - additionalProperties = - alertCreateForSubscriptionBody.additionalProperties.toMutableMap() - } + internal fun from(body: Body) = apply { + thresholds = body.thresholds.map { it.toMutableList() } + type = body.type + metricId = body.metricId + additionalProperties = body.additionalProperties.toMutableMap() + } /** The thresholds that define the values at which the alert will be triggered. */ fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds)) @@ -215,8 +212,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): AlertCreateForSubscriptionBody = - AlertCreateForSubscriptionBody( + fun build(): Body = + Body( checkRequired("thresholds", thresholds).map { it.toImmutable() }, checkRequired("type", type), metricId, @@ -229,7 +226,7 @@ private constructor( return true } - return /* spotless:off */ other is AlertCreateForSubscriptionBody && thresholds == other.thresholds && type == other.type && metricId == other.metricId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && thresholds == other.thresholds && type == other.type && metricId == other.metricId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -239,7 +236,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AlertCreateForSubscriptionBody{thresholds=$thresholds, type=$type, metricId=$metricId, additionalProperties=$additionalProperties}" + "Body{thresholds=$thresholds, type=$type, metricId=$metricId, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -254,8 +251,7 @@ private constructor( class Builder internal constructor() { private var subscriptionId: String? = null - private var body: AlertCreateForSubscriptionBody.Builder = - AlertCreateForSubscriptionBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -539,11 +535,7 @@ private constructor( } /** The type of alert to create. This must be a valid alert type. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 28d4372b..8b7674a3 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 @@ -87,11 +87,7 @@ private constructor( @JvmStatic fun of(alertsService: AlertService, params: AlertListParams, response: Response) = - AlertListPage( - alertsService, - params, - response, - ) + AlertListPage(alertsService, params, response) } @NoAutoDetect @@ -181,18 +177,11 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: AlertListPage, - ) : Iterable { + class AutoPager(private val firstPage: AlertListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 b6d17272..8d9ba767 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 @@ -90,11 +90,7 @@ private constructor( @JvmStatic fun of(alertsService: AlertServiceAsync, params: AlertListParams, response: Response) = - AlertListPageAsync( - alertsService, - params, - response, - ) + AlertListPageAsync(alertsService, params, response) } @NoAutoDetect @@ -184,23 +180,16 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: AlertListPageAsync, - ) { + class AutoPager(private val firstPage: AlertListPageAsync) { fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( action: (Alert) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -209,7 +198,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt index 3d7fbd2e..d1be2b8e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt @@ -74,25 +74,25 @@ private constructor( this.createdAtGt?.let { queryParams.put( "created_at[gt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtGte?.let { queryParams.put( "created_at[gte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLt?.let { queryParams.put( "created_at[lt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLte?.let { queryParams.put( "created_at[lte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) } 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 456a06c1..be397f6e 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 @@ -23,7 +23,7 @@ import java.util.Objects class AlertUpdateParams private constructor( private val alertConfigurationId: String, - private val body: AlertUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -42,7 +42,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): AlertUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -56,9 +56,9 @@ private constructor( } @NoAutoDetect - class AlertUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("thresholds") @ExcludeMissing private val thresholds: JsonField> = JsonMissing.of(), @@ -80,7 +80,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AlertUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -96,16 +96,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AlertUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var thresholds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(alertUpdateBody: AlertUpdateBody) = apply { - thresholds = alertUpdateBody.thresholds.map { it.toMutableList() } - additionalProperties = alertUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + thresholds = body.thresholds.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() } /** The thresholds that define the values at which the alert will be triggered. */ @@ -149,10 +149,10 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): AlertUpdateBody = - AlertUpdateBody( + fun build(): Body = + Body( checkRequired("thresholds", thresholds).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -161,7 +161,7 @@ private constructor( return true } - return /* spotless:off */ other is AlertUpdateBody && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -171,7 +171,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AlertUpdateBody{thresholds=$thresholds, additionalProperties=$additionalProperties}" + "Body{thresholds=$thresholds, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -186,7 +186,7 @@ private constructor( class Builder internal constructor() { private var alertConfigurationId: String? = null - private var body: AlertUpdateBody.Builder = AlertUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt index 5b1d58f3..2d087502 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt @@ -194,11 +194,8 @@ private constructor( ) } - class DiscountType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class DiscountType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -219,7 +216,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt index 6358f0da..9eb2451b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt @@ -223,7 +223,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -296,11 +296,7 @@ private constructor( override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillingCycleRelativeDate.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillingCycleRelativeDate.kt index e91cdb76..d1417195 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillingCycleRelativeDate.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillingCycleRelativeDate.kt @@ -9,9 +9,7 @@ import com.withorb.api.errors.OrbInvalidDataException class BillingCycleRelativeDate @JsonCreator -private constructor( - private val value: JsonField, -) : Enum { +private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt index 76e6f1ff..fe82de01 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt @@ -458,7 +458,7 @@ private constructor( override fun serialize( value: Discount, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.percentage != null -> generator.writeObject(value.percentage) 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 4d477bfa..37807bc2 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 @@ -39,7 +39,7 @@ import kotlin.jvm.optionals.getOrNull */ class CouponCreateParams private constructor( - private val body: CouponCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -84,16 +84,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): CouponCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class CouponCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("discount") @ExcludeMissing private val discount: JsonField = JsonMissing.of(), @@ -158,7 +158,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CouponCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -177,7 +177,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CouponCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var discount: JsonField? = null @@ -187,12 +187,12 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(couponCreateBody: CouponCreateBody) = apply { - discount = couponCreateBody.discount - redemptionCode = couponCreateBody.redemptionCode - durationInMonths = couponCreateBody.durationInMonths - maxRedemptions = couponCreateBody.maxRedemptions - additionalProperties = couponCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + discount = body.discount + redemptionCode = body.redemptionCode + durationInMonths = body.durationInMonths + maxRedemptions = body.maxRedemptions + additionalProperties = body.additionalProperties.toMutableMap() } fun discount(discount: Discount) = discount(JsonField.of(discount)) @@ -313,8 +313,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CouponCreateBody = - CouponCreateBody( + fun build(): Body = + Body( checkRequired("discount", discount), checkRequired("redemptionCode", redemptionCode), durationInMonths, @@ -328,7 +328,7 @@ private constructor( return true } - return /* spotless:off */ other is CouponCreateBody && discount == other.discount && redemptionCode == other.redemptionCode && durationInMonths == other.durationInMonths && maxRedemptions == other.maxRedemptions && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && discount == other.discount && redemptionCode == other.redemptionCode && durationInMonths == other.durationInMonths && maxRedemptions == other.maxRedemptions && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -338,7 +338,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CouponCreateBody{discount=$discount, redemptionCode=$redemptionCode, durationInMonths=$durationInMonths, maxRedemptions=$maxRedemptions, additionalProperties=$additionalProperties}" + "Body{discount=$discount, redemptionCode=$redemptionCode, durationInMonths=$durationInMonths, maxRedemptions=$maxRedemptions, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -352,7 +352,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: CouponCreateBody.Builder = CouponCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -720,7 +720,7 @@ private constructor( override fun serialize( value: Discount, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newCouponPercentage != null -> @@ -843,9 +843,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -866,7 +864,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -1059,9 +1057,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1082,7 +1078,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** 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 1fae071e..1f96b804 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 @@ -83,11 +83,7 @@ private constructor( @JvmStatic fun of(couponsService: CouponService, params: CouponListParams, response: Response) = - CouponListPage( - couponsService, - params, - response, - ) + CouponListPage(couponsService, params, response) } @NoAutoDetect @@ -177,18 +173,11 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CouponListPage, - ) : Iterable { + class AutoPager(private val firstPage: CouponListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 84aefe66..80198d16 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 @@ -86,11 +86,7 @@ private constructor( @JvmStatic fun of(couponsService: CouponServiceAsync, params: CouponListParams, response: Response) = - CouponListPageAsync( - couponsService, - params, - response, - ) + CouponListPageAsync(couponsService, params, response) } @NoAutoDetect @@ -180,23 +176,16 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CouponListPageAsync, - ) { + class AutoPager(private val firstPage: CouponListPageAsync) { fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( action: (Coupon) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -205,7 +194,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 2618230a..63dee1ce 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 @@ -84,13 +84,8 @@ private constructor( fun of( subscriptionsService: SubscriptionService, params: CouponSubscriptionListParams, - response: Response - ) = - CouponSubscriptionListPage( - subscriptionsService, - params, - response, - ) + response: Response, + ) = CouponSubscriptionListPage(subscriptionsService, params, response) } @NoAutoDetect @@ -180,18 +175,11 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CouponSubscriptionListPage, - ) : Iterable { + class AutoPager(private val firstPage: CouponSubscriptionListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 df82f6a3..e9fb4c04 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 @@ -87,13 +87,8 @@ private constructor( fun of( subscriptionsService: SubscriptionServiceAsync, params: CouponSubscriptionListParams, - response: Response - ) = - CouponSubscriptionListPageAsync( - subscriptionsService, - params, - response, - ) + response: Response, + ) = CouponSubscriptionListPageAsync(subscriptionsService, params, response) } @NoAutoDetect @@ -183,23 +178,16 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CouponSubscriptionListPageAsync, - ) { + class AutoPager(private val firstPage: CouponSubscriptionListPageAsync) { fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( action: (Subscription) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -208,7 +196,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt index 416feebb..84db23cb 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt @@ -1192,9 +1192,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1499,11 +1497,8 @@ private constructor( ) } - class DiscountType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class DiscountType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1524,7 +1519,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -1721,11 +1716,7 @@ private constructor( "MaximumAmountAdjustment{amountApplied=$amountApplied, discountType=$discountType, percentageDiscount=$percentageDiscount, appliesToPrices=$appliesToPrices, reason=$reason, additionalProperties=$additionalProperties}" } - class Reason - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Reason @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1824,11 +1815,7 @@ private constructor( override fun toString() = value.toString() } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2091,11 +2078,8 @@ private constructor( ) } - class DiscountType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class DiscountType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2116,7 +2100,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt index 8f621b09..b5e2dc2f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt @@ -25,7 +25,7 @@ import java.util.Optional /** This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). */ class CreditNoteCreateParams private constructor( - private val body: CreditNoteCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -52,16 +52,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): CreditNoteCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class CreditNoteCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("line_items") @ExcludeMissing private val lineItems: JsonField> = JsonMissing.of(), @@ -99,7 +99,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CreditNoteCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -117,7 +117,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CreditNoteCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var lineItems: JsonField>? = null @@ -126,11 +126,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(creditNoteCreateBody: CreditNoteCreateBody) = apply { - lineItems = creditNoteCreateBody.lineItems.map { it.toMutableList() } - memo = creditNoteCreateBody.memo - reason = creditNoteCreateBody.reason - additionalProperties = creditNoteCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + lineItems = body.lineItems.map { it.toMutableList() } + memo = body.memo + reason = body.reason + additionalProperties = body.additionalProperties.toMutableMap() } fun lineItems(lineItems: List) = lineItems(JsonField.of(lineItems)) @@ -189,8 +189,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CreditNoteCreateBody = - CreditNoteCreateBody( + fun build(): Body = + Body( checkRequired("lineItems", lineItems).map { it.toImmutable() }, memo, reason, @@ -203,7 +203,7 @@ private constructor( return true } - return /* spotless:off */ other is CreditNoteCreateBody && lineItems == other.lineItems && memo == other.memo && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && lineItems == other.lineItems && memo == other.memo && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -213,7 +213,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CreditNoteCreateBody{lineItems=$lineItems, memo=$memo, reason=$reason, additionalProperties=$additionalProperties}" + "Body{lineItems=$lineItems, memo=$memo, reason=$reason, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -227,7 +227,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: CreditNoteCreateBody.Builder = CreditNoteCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -513,11 +513,7 @@ private constructor( } /** An optional reason for the credit note. */ - class Reason - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Reason @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 bb4c34f1..41714fb8 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 @@ -83,13 +83,8 @@ private constructor( fun of( creditNotesService: CreditNoteService, params: CreditNoteListParams, - response: Response - ) = - CreditNoteListPage( - creditNotesService, - params, - response, - ) + response: Response, + ) = CreditNoteListPage(creditNotesService, params, response) } @NoAutoDetect @@ -179,18 +174,11 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CreditNoteListPage, - ) : Iterable { + class AutoPager(private val firstPage: CreditNoteListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 c97d1e38..412d467b 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 @@ -86,13 +86,8 @@ private constructor( fun of( creditNotesService: CreditNoteServiceAsync, params: CreditNoteListParams, - response: Response - ) = - CreditNoteListPageAsync( - creditNotesService, - params, - response, - ) + response: Response, + ) = CreditNoteListPageAsync(creditNotesService, params, response) } @NoAutoDetect @@ -182,23 +177,16 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CreditNoteListPageAsync, - ) { + class AutoPager(private val firstPage: CreditNoteListPageAsync) { fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( action: (CreditNote) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -207,7 +195,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt index 9af3e19f..747c067b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt @@ -1381,7 +1381,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -1458,11 +1458,8 @@ private constructor( * This is used for creating charges or invoices in an external system via Orb. When not in test * mode, the connection must first be configured in the Orb webapp. */ - class PaymentProvider - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PaymentProvider @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1970,11 +1967,8 @@ private constructor( ) } - class Country - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Country @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2520,11 +2514,7 @@ private constructor( override fun toString() = value.toString() } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3275,9 +3265,7 @@ private constructor( class ProviderType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3480,7 +3468,7 @@ private constructor( fun build(): ReportingConfiguration = ReportingConfiguration( checkRequired("exempt", exempt), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } 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 bb529d6e..29e63567 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 @@ -29,7 +29,7 @@ import java.util.Optional class CustomerBalanceTransactionCreateParams private constructor( private val customerId: String, - private val body: CustomerBalanceTransactionCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -56,7 +56,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): CustomerBalanceTransactionCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -70,9 +70,9 @@ private constructor( } @NoAutoDetect - class CustomerBalanceTransactionCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), @@ -107,7 +107,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CustomerBalanceTransactionCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -125,7 +125,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CustomerBalanceTransactionCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -134,14 +134,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - customerBalanceTransactionCreateBody: CustomerBalanceTransactionCreateBody - ) = apply { - amount = customerBalanceTransactionCreateBody.amount - type = customerBalanceTransactionCreateBody.type - description = customerBalanceTransactionCreateBody.description - additionalProperties = - customerBalanceTransactionCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + amount = body.amount + type = body.type + description = body.description + additionalProperties = body.additionalProperties.toMutableMap() } fun amount(amount: String) = amount(JsonField.of(amount)) @@ -182,8 +179,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CustomerBalanceTransactionCreateBody = - CustomerBalanceTransactionCreateBody( + fun build(): Body = + Body( checkRequired("amount", amount), checkRequired("type", type), description, @@ -196,7 +193,7 @@ private constructor( return true } - return /* spotless:off */ other is CustomerBalanceTransactionCreateBody && amount == other.amount && type == other.type && description == other.description && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && amount == other.amount && type == other.type && description == other.description && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -206,7 +203,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CustomerBalanceTransactionCreateBody{amount=$amount, type=$type, description=$description, additionalProperties=$additionalProperties}" + "Body{amount=$amount, type=$type, description=$description, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -221,8 +218,7 @@ private constructor( class Builder internal constructor() { private var customerId: String? = null - private var body: CustomerBalanceTransactionCreateBody.Builder = - CustomerBalanceTransactionCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -382,11 +378,7 @@ private constructor( ) } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt index e8dc7498..3063f318 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt @@ -300,11 +300,7 @@ private constructor( ) } - class Action - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Action @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -623,11 +619,7 @@ private constructor( override fun toString() = "Invoice{id=$id, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 481ae313..65125150 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 @@ -104,13 +104,8 @@ private constructor( fun of( balanceTransactionsService: BalanceTransactionService, params: CustomerBalanceTransactionListParams, - response: Response - ) = - CustomerBalanceTransactionListPage( - balanceTransactionsService, - params, - response, - ) + response: Response, + ) = CustomerBalanceTransactionListPage(balanceTransactionsService, params, response) } @NoAutoDetect @@ -207,18 +202,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerBalanceTransactionListPage, - ) : Iterable { + class AutoPager(private val firstPage: CustomerBalanceTransactionListPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 ffd6c712..d9de8ceb 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 @@ -107,13 +107,8 @@ private constructor( fun of( balanceTransactionsService: BalanceTransactionServiceAsync, params: CustomerBalanceTransactionListParams, - response: Response - ) = - CustomerBalanceTransactionListPageAsync( - balanceTransactionsService, - params, - response, - ) + response: Response, + ) = CustomerBalanceTransactionListPageAsync(balanceTransactionsService, params, response) } @NoAutoDetect @@ -210,26 +205,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerBalanceTransactionListPageAsync, - ) { + class AutoPager(private val firstPage: CustomerBalanceTransactionListPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (CustomerBalanceTransactionListResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -238,7 +226,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 54fd58b2..56e7978e 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 @@ -83,25 +83,25 @@ private constructor( this.operationTimeGt?.let { queryParams.put( "operation_time[gt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.operationTimeGte?.let { queryParams.put( "operation_time[gte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.operationTimeLt?.let { queryParams.put( "operation_time[lt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.operationTimeLte?.let { queryParams.put( "operation_time[lte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } queryParams.putAll(additionalQueryParams) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt index 817ff3b2..7bafb9d0 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt @@ -300,11 +300,7 @@ private constructor( ) } - class Action - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Action @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -623,11 +619,7 @@ private constructor( override fun toString() = "Invoice{id=$id, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 b9145099..22574831 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 @@ -165,13 +165,13 @@ private constructor( this.timeframeEnd?.let { queryParams.put( "timeframe_end", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.timeframeStart?.let { queryParams.put( "timeframe_start", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.viewMode?.let { queryParams.put("view_mode", listOf(it.toString())) } @@ -373,11 +373,7 @@ private constructor( * incremental day-by-day costs. If your customer has minimums or discounts, it's strongly * recommended that you use the default cumulative behavior. */ - class ViewMode - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ViewMode @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 eaaa61a6..1f6b42bc 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 @@ -110,7 +110,7 @@ private constructor( fun build(): CustomerCostListByExternalIdResponse = CustomerCostListByExternalIdResponse( checkRequired("data", data).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } 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 dcd0ee24..03dfce3b 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 @@ -165,13 +165,13 @@ private constructor( this.timeframeEnd?.let { queryParams.put( "timeframe_end", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.timeframeStart?.let { queryParams.put( "timeframe_start", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.viewMode?.let { queryParams.put("view_mode", listOf(it.toString())) } @@ -369,11 +369,7 @@ private constructor( * incremental day-by-day costs. If your customer has minimums or discounts, it's strongly * recommended that you use the default cumulative behavior. */ - class ViewMode - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ViewMode @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 c5460b96..561c33f9 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 @@ -107,7 +107,7 @@ private constructor( fun build(): CustomerCostListResponse = CustomerCostListResponse( checkRequired("data", data).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } 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 44e2b86d..4b1f7df4 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 @@ -47,7 +47,7 @@ import kotlin.jvm.optionals.getOrNull */ class CustomerCreateParams private constructor( - private val body: CustomerCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -423,16 +423,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): CustomerCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class CustomerCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("email") @ExcludeMissing private val email: JsonField = JsonMissing.of(), @@ -893,7 +893,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CustomerCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -925,7 +925,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CustomerCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var email: JsonField? = null @@ -949,25 +949,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(customerCreateBody: CustomerCreateBody) = apply { - email = customerCreateBody.email - name = customerCreateBody.name - accountingSyncConfiguration = customerCreateBody.accountingSyncConfiguration - additionalEmails = customerCreateBody.additionalEmails.map { it.toMutableList() } - autoCollection = customerCreateBody.autoCollection - billingAddress = customerCreateBody.billingAddress - currency = customerCreateBody.currency - emailDelivery = customerCreateBody.emailDelivery - externalCustomerId = customerCreateBody.externalCustomerId - metadata = customerCreateBody.metadata - paymentProvider = customerCreateBody.paymentProvider - paymentProviderId = customerCreateBody.paymentProviderId - reportingConfiguration = customerCreateBody.reportingConfiguration - shippingAddress = customerCreateBody.shippingAddress - taxConfiguration = customerCreateBody.taxConfiguration - taxId = customerCreateBody.taxId - timezone = customerCreateBody.timezone - additionalProperties = customerCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + email = body.email + name = body.name + accountingSyncConfiguration = body.accountingSyncConfiguration + additionalEmails = body.additionalEmails.map { it.toMutableList() } + autoCollection = body.autoCollection + billingAddress = body.billingAddress + currency = body.currency + emailDelivery = body.emailDelivery + externalCustomerId = body.externalCustomerId + metadata = body.metadata + paymentProvider = body.paymentProvider + paymentProviderId = body.paymentProviderId + reportingConfiguration = body.reportingConfiguration + shippingAddress = body.shippingAddress + taxConfiguration = body.taxConfiguration + taxId = body.taxId + timezone = body.timezone + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -1629,8 +1629,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CustomerCreateBody = - CustomerCreateBody( + fun build(): Body = + Body( checkRequired("email", email), checkRequired("name", name), accountingSyncConfiguration, @@ -1657,7 +1657,7 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreateBody && email == other.email && name == other.name && accountingSyncConfiguration == other.accountingSyncConfiguration && additionalEmails == other.additionalEmails && autoCollection == other.autoCollection && billingAddress == other.billingAddress && currency == other.currency && emailDelivery == other.emailDelivery && externalCustomerId == other.externalCustomerId && metadata == other.metadata && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && reportingConfiguration == other.reportingConfiguration && shippingAddress == other.shippingAddress && taxConfiguration == other.taxConfiguration && taxId == other.taxId && timezone == other.timezone && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && email == other.email && name == other.name && accountingSyncConfiguration == other.accountingSyncConfiguration && additionalEmails == other.additionalEmails && autoCollection == other.autoCollection && billingAddress == other.billingAddress && currency == other.currency && emailDelivery == other.emailDelivery && externalCustomerId == other.externalCustomerId && metadata == other.metadata && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && reportingConfiguration == other.reportingConfiguration && shippingAddress == other.shippingAddress && taxConfiguration == other.taxConfiguration && taxId == other.taxId && timezone == other.timezone && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1667,7 +1667,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CustomerCreateBody{email=$email, name=$name, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, timezone=$timezone, additionalProperties=$additionalProperties}" + "Body{email=$email, name=$name, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, timezone=$timezone, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -1681,7 +1681,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: CustomerCreateBody.Builder = CustomerCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -2904,7 +2904,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -2981,11 +2981,8 @@ private constructor( * This is used for creating charges or invoices in an external system via Orb. When not in test * mode, the connection must first be configured in the Orb webapp. */ - class PaymentProvider - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PaymentProvider @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3168,7 +3165,7 @@ private constructor( fun build(): ReportingConfiguration = ReportingConfiguration( checkRequired("exempt", exempt), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -3518,7 +3515,7 @@ private constructor( override fun serialize( value: TaxConfiguration, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newAvalara != null -> generator.writeObject(value.newAvalara) @@ -3659,9 +3656,7 @@ private constructor( class TaxProvider @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3682,7 +3677,7 @@ private constructor( /** An enum containing [TaxProvider]'s known values. */ enum class Known { - AVALARA, + AVALARA } /** @@ -3870,9 +3865,7 @@ private constructor( class TaxProvider @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3893,7 +3886,7 @@ private constructor( /** An enum containing [TaxProvider]'s known values. */ enum class Known { - TAXJAR, + TAXJAR } /** @@ -4189,11 +4182,8 @@ private constructor( ) } - class Country - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Country @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4739,11 +4729,7 @@ private constructor( override fun toString() = value.toString() } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 e2a9d768..e205cc67 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 @@ -140,37 +140,20 @@ import kotlin.jvm.optionals.getOrNull class CustomerCreditLedgerCreateEntryByExternalIdParams private constructor( private val externalCustomerId: String, - private val body: CustomerCreditLedgerCreateEntryByExternalIdBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { fun externalCustomerId(): String = externalCustomerId - fun addIncrementCreditLedgerEntryRequestParams(): - Optional = - body.addIncrementCreditLedgerEntryRequestParams() - - fun addDecrementCreditLedgerEntryRequestParams(): - Optional = - body.addDecrementCreditLedgerEntryRequestParams() - - fun addExpirationChangeCreditLedgerEntryRequestParams(): - Optional = - body.addExpirationChangeCreditLedgerEntryRequestParams() - - fun addVoidCreditLedgerEntryRequestParams(): Optional = - body.addVoidCreditLedgerEntryRequestParams() - - fun addAmendmentCreditLedgerEntryRequestParams(): - Optional = - body.addAmendmentCreditLedgerEntryRequestParams() + fun body(): Body = body fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): CustomerCreditLedgerCreateEntryByExternalIdBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -183,10 +166,10 @@ private constructor( } } - @JsonDeserialize(using = CustomerCreditLedgerCreateEntryByExternalIdBody.Deserializer::class) - @JsonSerialize(using = CustomerCreditLedgerCreateEntryByExternalIdBody.Serializer::class) - class CustomerCreditLedgerCreateEntryByExternalIdBody - internal constructor( + @JsonDeserialize(using = Body.Deserializer::class) + @JsonSerialize(using = Body.Serializer::class) + class Body + private constructor( private val addIncrementCreditLedgerEntryRequestParams: AddIncrementCreditLedgerEntryRequestParams? = null, @@ -296,12 +279,59 @@ private constructor( } } + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitAddIncrementCreditLedgerEntryRequestParams( + addIncrementCreditLedgerEntryRequestParams: + AddIncrementCreditLedgerEntryRequestParams + ) { + addIncrementCreditLedgerEntryRequestParams.validate() + } + + override fun visitAddDecrementCreditLedgerEntryRequestParams( + addDecrementCreditLedgerEntryRequestParams: + AddDecrementCreditLedgerEntryRequestParams + ) { + addDecrementCreditLedgerEntryRequestParams.validate() + } + + override fun visitAddExpirationChangeCreditLedgerEntryRequestParams( + addExpirationChangeCreditLedgerEntryRequestParams: + AddExpirationChangeCreditLedgerEntryRequestParams + ) { + addExpirationChangeCreditLedgerEntryRequestParams.validate() + } + + override fun visitAddVoidCreditLedgerEntryRequestParams( + addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams + ) { + addVoidCreditLedgerEntryRequestParams.validate() + } + + override fun visitAddAmendmentCreditLedgerEntryRequestParams( + addAmendmentCreditLedgerEntryRequestParams: + AddAmendmentCreditLedgerEntryRequestParams + ) { + addAmendmentCreditLedgerEntryRequestParams.validate() + } + } + ) + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditLedgerCreateEntryByExternalIdBody && addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams /* spotless:on */ + return /* spotless:off */ other is Body && addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams /* spotless:on */ } override fun hashCode(): Int = /* spotless:off */ Objects.hash(addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams) /* spotless:on */ @@ -309,20 +339,17 @@ private constructor( override fun toString(): String = when { addIncrementCreditLedgerEntryRequestParams != null -> - "CustomerCreditLedgerCreateEntryByExternalIdBody{addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams}" + "Body{addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams}" addDecrementCreditLedgerEntryRequestParams != null -> - "CustomerCreditLedgerCreateEntryByExternalIdBody{addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams}" + "Body{addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams}" addExpirationChangeCreditLedgerEntryRequestParams != null -> - "CustomerCreditLedgerCreateEntryByExternalIdBody{addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams}" + "Body{addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams}" addVoidCreditLedgerEntryRequestParams != null -> - "CustomerCreditLedgerCreateEntryByExternalIdBody{addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams}" + "Body{addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams}" addAmendmentCreditLedgerEntryRequestParams != null -> - "CustomerCreditLedgerCreateEntryByExternalIdBody{addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams}" - _json != null -> "CustomerCreditLedgerCreateEntryByExternalIdBody{_unknown=$_json}" - else -> - throw IllegalStateException( - "Invalid CustomerCreditLedgerCreateEntryByExternalIdBody" - ) + "Body{addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams}" + _json != null -> "Body{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Body") } companion object { @@ -332,7 +359,7 @@ private constructor( addIncrementCreditLedgerEntryRequestParams: AddIncrementCreditLedgerEntryRequestParams ) = - CustomerCreditLedgerCreateEntryByExternalIdBody( + Body( addIncrementCreditLedgerEntryRequestParams = addIncrementCreditLedgerEntryRequestParams ) @@ -342,7 +369,7 @@ private constructor( addDecrementCreditLedgerEntryRequestParams: AddDecrementCreditLedgerEntryRequestParams ) = - CustomerCreditLedgerCreateEntryByExternalIdBody( + Body( addDecrementCreditLedgerEntryRequestParams = addDecrementCreditLedgerEntryRequestParams ) @@ -352,7 +379,7 @@ private constructor( addExpirationChangeCreditLedgerEntryRequestParams: AddExpirationChangeCreditLedgerEntryRequestParams ) = - CustomerCreditLedgerCreateEntryByExternalIdBody( + Body( addExpirationChangeCreditLedgerEntryRequestParams = addExpirationChangeCreditLedgerEntryRequestParams ) @@ -360,26 +387,20 @@ private constructor( @JvmStatic fun ofAddVoidCreditLedgerEntryRequestParams( addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ) = - CustomerCreditLedgerCreateEntryByExternalIdBody( - addVoidCreditLedgerEntryRequestParams = addVoidCreditLedgerEntryRequestParams - ) + ) = Body(addVoidCreditLedgerEntryRequestParams = addVoidCreditLedgerEntryRequestParams) @JvmStatic fun ofAddAmendmentCreditLedgerEntryRequestParams( addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams ) = - CustomerCreditLedgerCreateEntryByExternalIdBody( + Body( addAmendmentCreditLedgerEntryRequestParams = addAmendmentCreditLedgerEntryRequestParams ) } - /** - * An interface that defines how to map each variant of - * [CustomerCreditLedgerCreateEntryByExternalIdBody] to a value of type [T]. - */ + /** An interface that defines how to map each variant of [Body] to a value of type [T]. */ interface Visitor { fun visitAddIncrementCreditLedgerEntryRequestParams( @@ -407,31 +428,22 @@ private constructor( ): T /** - * Maps an unknown variant of [CustomerCreditLedgerCreateEntryByExternalIdBody] to a - * value of type [T]. + * Maps an unknown variant of [Body] to a value of type [T]. * - * An instance of [CustomerCreditLedgerCreateEntryByExternalIdBody] can contain an - * unknown variant if it was deserialized from data that doesn't match any known - * variant. For example, if the SDK is on an older version than the API, then the API - * may respond with new variants that the SDK is unaware of. + * An instance of [Body] can contain an unknown variant if it was deserialized from data + * that doesn't match any known variant. For example, if the SDK is on an older version + * than the API, then the API may respond with new variants that the SDK is unaware of. * * @throws OrbInvalidDataException in the default implementation. */ fun unknown(json: JsonValue?): T { - throw OrbInvalidDataException( - "Unknown CustomerCreditLedgerCreateEntryByExternalIdBody: $json" - ) + throw OrbInvalidDataException("Unknown Body: $json") } } - internal class Deserializer : - BaseDeserializer( - CustomerCreditLedgerCreateEntryByExternalIdBody::class - ) { + internal class Deserializer : BaseDeserializer(Body::class) { - override fun ObjectCodec.deserialize( - node: JsonNode - ): CustomerCreditLedgerCreateEntryByExternalIdBody { + override fun ObjectCodec.deserialize(node: JsonNode): Body { val json = JsonValue.fromJsonNode(node) val entryType = json.asObject().getOrNull()?.get("entry_type")?.asString()?.getOrNull() @@ -440,78 +452,85 @@ private constructor( "increment" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return CustomerCreditLedgerCreateEntryByExternalIdBody( + return Body( addIncrementCreditLedgerEntryRequestParams = it, - _json = json + _json = json, ) } } "decrement" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return CustomerCreditLedgerCreateEntryByExternalIdBody( + return Body( addDecrementCreditLedgerEntryRequestParams = it, - _json = json + _json = json, ) } } "expiration_change" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return CustomerCreditLedgerCreateEntryByExternalIdBody( + return Body( addExpirationChangeCreditLedgerEntryRequestParams = it, - _json = json + _json = json, ) } } "void" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return CustomerCreditLedgerCreateEntryByExternalIdBody( + return Body( addVoidCreditLedgerEntryRequestParams = it, - _json = json + _json = json, ) } } "amendment" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return CustomerCreditLedgerCreateEntryByExternalIdBody( + return Body( addAmendmentCreditLedgerEntryRequestParams = it, - _json = json + _json = json, ) } } } - return CustomerCreditLedgerCreateEntryByExternalIdBody(_json = json) + return Body(_json = json) } } - internal class Serializer : - BaseSerializer( - CustomerCreditLedgerCreateEntryByExternalIdBody::class - ) { + internal class Serializer : BaseSerializer(Body::class) { override fun serialize( - value: CustomerCreditLedgerCreateEntryByExternalIdBody, + value: Body, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.addIncrementCreditLedgerEntryRequestParams != null -> @@ -527,509 +546,514 @@ private constructor( value.addAmendmentCreditLedgerEntryRequestParams != null -> generator.writeObject(value.addAmendmentCreditLedgerEntryRequestParams) value._json != null -> generator.writeObject(value._json) - else -> - throw IllegalStateException( - "Invalid CustomerCreditLedgerCreateEntryByExternalIdBody" - ) + else -> throw IllegalStateException("Invalid Body") } } } - } - fun toBuilder() = Builder().from(this) + @NoAutoDetect + class AddIncrementCreditLedgerEntryRequestParams + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") + @ExcludeMissing + private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("effective_date") + @ExcludeMissing + private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("expiry_date") + @ExcludeMissing + private val expiryDate: JsonField = JsonMissing.of(), + @JsonProperty("invoice_settings") + @ExcludeMissing + private val invoiceSettings: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("per_unit_cost_basis") + @ExcludeMissing + private val perUnitCostBasis: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - companion object { + /** + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. + */ + fun amount(): Double = amount.getRequired("amount") - @JvmStatic fun builder() = Builder() - } + fun entryType(): EntryType = entryType.getRequired("entry_type") - /** A builder for [CustomerCreditLedgerCreateEntryByExternalIdParams]. */ - @NoAutoDetect - class Builder internal constructor() { + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - private var externalCustomerId: String? = null - private var body: CustomerCreditLedgerCreateEntryByExternalIdBody? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) - @JvmSynthetic - internal fun from( - customerCreditLedgerCreateEntryByExternalIdParams: - CustomerCreditLedgerCreateEntryByExternalIdParams - ) = apply { - externalCustomerId = - customerCreditLedgerCreateEntryByExternalIdParams.externalCustomerId - body = customerCreditLedgerCreateEntryByExternalIdParams.body - additionalHeaders = - customerCreditLedgerCreateEntryByExternalIdParams.additionalHeaders.toBuilder() - additionalQueryParams = - customerCreditLedgerCreateEntryByExternalIdParams.additionalQueryParams.toBuilder() - } + /** + * An ISO 8601 format date that denotes when this credit balance should become available + * for use. + */ + fun effectiveDate(): Optional = + Optional.ofNullable(effectiveDate.getNullable("effective_date")) - fun externalCustomerId(externalCustomerId: String) = apply { - this.externalCustomerId = externalCustomerId - } + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + fun expiryDate(): Optional = + Optional.ofNullable(expiryDate.getNullable("expiry_date")) - fun forAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams: AddIncrementCreditLedgerEntryRequestParams - ) = apply { - body = - CustomerCreditLedgerCreateEntryByExternalIdBody - .ofAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams - ) - } + /** + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as + * the calculation of the invoice total is done on that basis. + */ + fun invoiceSettings(): Optional = + Optional.ofNullable(invoiceSettings.getNullable("invoice_settings")) - fun forAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams: AddDecrementCreditLedgerEntryRequestParams - ) = apply { - body = - CustomerCreditLedgerCreateEntryByExternalIdBody - .ofAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams - ) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - fun forAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams - ) = apply { - body = - CustomerCreditLedgerCreateEntryByExternalIdBody - .ofAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams - ) - } + /** + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block + */ + fun perUnitCostBasis(): Optional = + Optional.ofNullable(perUnitCostBasis.getNullable("per_unit_cost_basis")) - fun forAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ) = apply { - body = - CustomerCreditLedgerCreateEntryByExternalIdBody - .ofAddVoidCreditLedgerEntryRequestParams(addVoidCreditLedgerEntryRequestParams) - } + /** + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - fun forAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams - ) = apply { - body = - CustomerCreditLedgerCreateEntryByExternalIdBody - .ofAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams - ) - } + @JsonProperty("entry_type") + @ExcludeMissing + fun _entryType(): JsonField = entryType - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } + /** + * An ISO 8601 format date that denotes when this credit balance should become available + * for use. + */ + @JsonProperty("effective_date") + @ExcludeMissing + fun _effectiveDate(): JsonField = effectiveDate - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + @JsonProperty("expiry_date") + @ExcludeMissing + fun _expiryDate(): JsonField = expiryDate - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as + * the calculation of the invoice total is done on that basis. + */ + @JsonProperty("invoice_settings") + @ExcludeMissing + fun _invoiceSettings(): JsonField = invoiceSettings - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } + /** + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block + */ + @JsonProperty("per_unit_cost_basis") + @ExcludeMissing + fun _perUnitCostBasis(): JsonField = perUnitCostBasis - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + private var validated: Boolean = false - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + fun validate(): AddIncrementCreditLedgerEntryRequestParams = apply { + if (validated) { + return@apply + } - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + amount() + entryType() + currency() + description() + effectiveDate() + expiryDate() + invoiceSettings().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + perUnitCostBasis() + validated = true + } - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + fun toBuilder() = Builder().from(this) - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + companion object { - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + @JvmStatic fun builder() = Builder() + } - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + /** A builder for [AddIncrementCreditLedgerEntryRequestParams]. */ + class Builder internal constructor() { - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } + private var amount: JsonField? = null + private var entryType: JsonField? = null + private var currency: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var effectiveDate: JsonField = JsonMissing.of() + private var expiryDate: JsonField = JsonMissing.of() + private var invoiceSettings: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var perUnitCostBasis: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + @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() + } - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } + fun entryType(entryType: JsonField) = apply { + this.entryType = entryType + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - fun build(): CustomerCreditLedgerCreateEntryByExternalIdParams = - CustomerCreditLedgerCreateEntryByExternalIdParams( - checkRequired("externalCustomerId", externalCustomerId), - body ?: CustomerCreditLedgerCreateEntryByExternalIdBody(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) - @NoAutoDetect - class AddIncrementCreditLedgerEntryRequestParams - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("effective_date") - @ExcludeMissing - private val effectiveDate: JsonField = JsonMissing.of(), - @JsonProperty("expiry_date") - @ExcludeMissing - private val expiryDate: JsonField = JsonMissing.of(), - @JsonProperty("invoice_settings") - @ExcludeMissing - private val invoiceSettings: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonProperty("per_unit_cost_basis") - @ExcludeMissing - private val perUnitCostBasis: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: Optional) = + description(description.orElse(null)) - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(): Double = amount.getRequired("amount") - - fun entryType(): EntryType = entryType.getRequired("entry_type") - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * An ISO 8601 format date that denotes when this credit balance should become available for - * use. - */ - fun effectiveDate(): Optional = - Optional.ofNullable(effectiveDate.getNullable("effective_date")) - - /** An ISO 8601 format date that denotes when this credit balance should expire. */ - fun expiryDate(): Optional = - Optional.ofNullable(expiryDate.getNullable("expiry_date")) - - /** - * Passing `invoice_settings` automatically generates an invoice for the newly added - * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the - * calculation of the invoice total is done on that basis. - */ - fun invoiceSettings(): Optional = - Optional.ofNullable(invoiceSettings.getNullable("invoice_settings")) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** - * Can only be specified when entry_type=increment. How much, in the customer's currency, a - * customer paid for a single credit in this block - */ - fun perUnitCostBasis(): Optional = - Optional.ofNullable(perUnitCostBasis.getNullable("per_unit_cost_basis")) - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * An ISO 8601 format date that denotes when this credit balance should become available for - * use. - */ - @JsonProperty("effective_date") - @ExcludeMissing - fun _effectiveDate(): JsonField = effectiveDate - - /** An ISO 8601 format date that denotes when this credit balance should expire. */ - @JsonProperty("expiry_date") - @ExcludeMissing - fun _expiryDate(): JsonField = expiryDate - - /** - * Passing `invoice_settings` automatically generates an invoice for the newly added - * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the - * calculation of the invoice total is done on that basis. - */ - @JsonProperty("invoice_settings") - @ExcludeMissing - fun _invoiceSettings(): JsonField = invoiceSettings - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - /** - * Can only be specified when entry_type=increment. How much, in the customer's currency, a - * customer paid for a single credit in this block - */ - @JsonProperty("per_unit_cost_basis") - @ExcludeMissing - fun _perUnitCostBasis(): JsonField = perUnitCostBasis - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: JsonField) = apply { + this.description = description + } - private var validated: Boolean = false + /** + * An ISO 8601 format date that denotes when this credit balance should become + * available for use. + */ + fun effectiveDate(effectiveDate: OffsetDateTime?) = + effectiveDate(JsonField.ofNullable(effectiveDate)) - fun validate(): AddIncrementCreditLedgerEntryRequestParams = apply { - if (validated) { - return@apply - } + /** + * An ISO 8601 format date that denotes when this credit balance should become + * available for use. + */ + fun effectiveDate(effectiveDate: Optional) = + effectiveDate(effectiveDate.orElse(null)) - amount() - entryType() - currency() - description() - effectiveDate() - expiryDate() - invoiceSettings().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - perUnitCostBasis() - validated = true - } + /** + * An ISO 8601 format date that denotes when this credit balance should become + * available for use. + */ + fun effectiveDate(effectiveDate: JsonField) = apply { + this.effectiveDate = effectiveDate + } - fun toBuilder() = Builder().from(this) + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + fun expiryDate(expiryDate: OffsetDateTime?) = + expiryDate(JsonField.ofNullable(expiryDate)) - companion object { + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + fun expiryDate(expiryDate: Optional) = + expiryDate(expiryDate.orElse(null)) - @JvmStatic fun builder() = Builder() - } + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + fun expiryDate(expiryDate: JsonField) = apply { + this.expiryDate = expiryDate + } - /** A builder for [AddIncrementCreditLedgerEntryRequestParams]. */ - class Builder internal constructor() { - - private var amount: JsonField? = null - private var entryType: JsonField? = null - private var currency: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var effectiveDate: JsonField = JsonMissing.of() - private var expiryDate: JsonField = JsonMissing.of() - private var invoiceSettings: JsonField = JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - private var perUnitCostBasis: JsonField = JsonMissing.of() - 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() - } + /** + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, + * as the calculation of the invoice total is done on that basis. + */ + fun invoiceSettings(invoiceSettings: InvoiceSettings?) = + invoiceSettings(JsonField.ofNullable(invoiceSettings)) - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(amount: Double) = amount(JsonField.of(amount)) + /** + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, + * as the calculation of the invoice total is done on that basis. + */ + fun invoiceSettings(invoiceSettings: Optional) = + invoiceSettings(invoiceSettings.orElse(null)) - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } + /** + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, + * as the calculation of the invoice total is done on that basis. + */ + fun invoiceSettings(invoiceSettings: JsonField) = apply { + this.invoiceSettings = invoiceSettings + } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + /** + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block + */ + fun perUnitCostBasis(perUnitCostBasis: String?) = + perUnitCostBasis(JsonField.ofNullable(perUnitCostBasis)) - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block + */ + fun perUnitCostBasis(perUnitCostBasis: Optional) = + perUnitCostBasis(perUnitCostBasis.orElse(null)) - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: String?) = description(JsonField.ofNullable(description)) + /** + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block + */ + fun perUnitCostBasis(perUnitCostBasis: JsonField) = apply { + this.perUnitCostBasis = perUnitCostBasis + } - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: Optional) = description(description.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: JsonField) = apply { - this.description = description - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * An ISO 8601 format date that denotes when this credit balance should become available - * for use. - */ - fun effectiveDate(effectiveDate: OffsetDateTime?) = - effectiveDate(JsonField.ofNullable(effectiveDate)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * An ISO 8601 format date that denotes when this credit balance should become available - * for use. - */ - fun effectiveDate(effectiveDate: Optional) = - effectiveDate(effectiveDate.orElse(null)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * An ISO 8601 format date that denotes when this credit balance should become available - * for use. - */ - fun effectiveDate(effectiveDate: JsonField) = apply { - this.effectiveDate = effectiveDate + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): AddIncrementCreditLedgerEntryRequestParams = + AddIncrementCreditLedgerEntryRequestParams( + checkRequired("amount", amount), + checkRequired("entryType", entryType), + currency, + description, + effectiveDate, + expiryDate, + invoiceSettings, + metadata, + perUnitCostBasis, + additionalProperties.toImmutable(), + ) } - /** An ISO 8601 format date that denotes when this credit balance should expire. */ - fun expiryDate(expiryDate: OffsetDateTime?) = - expiryDate(JsonField.ofNullable(expiryDate)) + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** An ISO 8601 format date that denotes when this credit balance should expire. */ - fun expiryDate(expiryDate: Optional) = - expiryDate(expiryDate.orElse(null)) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** An ISO 8601 format date that denotes when this credit balance should expire. */ - fun expiryDate(expiryDate: JsonField) = apply { - this.expiryDate = expiryDate + 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") + } + + fun asString(): String = _value().asStringOrThrow() + + 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() } /** @@ -1037,265 +1061,416 @@ private constructor( * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as * the calculation of the invoice total is done on that basis. */ - fun invoiceSettings(invoiceSettings: InvoiceSettings?) = - invoiceSettings(JsonField.ofNullable(invoiceSettings)) + @NoAutoDetect + class InvoiceSettings + @JsonCreator + private constructor( + @JsonProperty("auto_collection") + @ExcludeMissing + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("net_terms") + @ExcludeMissing + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("memo") + @ExcludeMissing + private val memo: JsonField = JsonMissing.of(), + @JsonProperty("require_successful_payment") + @ExcludeMissing + private val requireSuccessfulPayment: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** - * Passing `invoice_settings` automatically generates an invoice for the newly added - * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as - * the calculation of the invoice total is done on that basis. - */ - fun invoiceSettings(invoiceSettings: Optional) = - invoiceSettings(invoiceSettings.orElse(null)) + /** + * Whether the credits purchase invoice should auto collect with the customer's + * saved payment method. + */ + fun autoCollection(): Boolean = autoCollection.getRequired("auto_collection") - /** - * Passing `invoice_settings` automatically generates an invoice for the newly added - * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as - * the calculation of the invoice total is done on that basis. - */ - fun invoiceSettings(invoiceSettings: JsonField) = apply { - this.invoiceSettings = invoiceSettings - } + /** + * The net terms determines the difference between the invoice date and the issue + * date for the invoice. If you intend the invoice to be due on issue, set this + * to 0. + */ + fun netTerms(): Long = netTerms.getRequired("net_terms") - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** An optional memo to display on the invoice. */ + fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo")) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + /** + * If true, the new credit block will require that the corresponding invoice is paid + * before it can be drawn down from. + */ + fun requireSuccessfulPayment(): Optional = + Optional.ofNullable( + requireSuccessfulPayment.getNullable("require_successful_payment") + ) + + /** + * Whether the credits purchase invoice should auto collect with the customer's + * saved payment method. + */ + @JsonProperty("auto_collection") + @ExcludeMissing + fun _autoCollection(): JsonField = autoCollection + + /** + * The net terms determines the difference between the invoice date and the issue + * date for the invoice. If you intend the invoice to be due on issue, set this + * to 0. + */ + @JsonProperty("net_terms") + @ExcludeMissing + fun _netTerms(): JsonField = netTerms + + /** An optional memo to display on the invoice. */ + @JsonProperty("memo") @ExcludeMissing fun _memo(): JsonField = memo + + /** + * If true, the new credit block will require that the corresponding invoice is paid + * before it can be drawn down from. + */ + @JsonProperty("require_successful_payment") + @ExcludeMissing + fun _requireSuccessfulPayment(): JsonField = requireSuccessfulPayment + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoiceSettings = apply { + if (validated) { + return@apply + } + + autoCollection() + netTerms() + memo() + requireSuccessfulPayment() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InvoiceSettings]. */ + class Builder internal constructor() { + + private var autoCollection: JsonField? = null + private var netTerms: JsonField? = null + private var memo: JsonField = JsonMissing.of() + private var requireSuccessfulPayment: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoiceSettings: InvoiceSettings) = apply { + autoCollection = invoiceSettings.autoCollection + netTerms = invoiceSettings.netTerms + memo = invoiceSettings.memo + requireSuccessfulPayment = invoiceSettings.requireSuccessfulPayment + additionalProperties = invoiceSettings.additionalProperties.toMutableMap() + } + + /** + * Whether the credits purchase invoice should auto collect with the customer's + * saved payment method. + */ + fun autoCollection(autoCollection: Boolean) = + autoCollection(JsonField.of(autoCollection)) + + /** + * Whether the credits purchase invoice should auto collect with the customer's + * saved payment method. + */ + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } + + /** + * The net terms determines the difference between the invoice date and the + * issue date for the invoice. If you intend the invoice to be due on issue, set + * this to 0. + */ + fun netTerms(netTerms: Long) = netTerms(JsonField.of(netTerms)) + + /** + * The net terms determines the difference between the invoice date and the + * issue date for the invoice. If you intend the invoice to be due on issue, set + * this to 0. + */ + fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } + + /** An optional memo to display on the invoice. */ + fun memo(memo: String?) = memo(JsonField.ofNullable(memo)) + + /** An optional memo to display on the invoice. */ + fun memo(memo: Optional) = memo(memo.orElse(null)) + + /** An optional memo to display on the invoice. */ + fun memo(memo: JsonField) = apply { this.memo = memo } + + /** + * If true, the new credit block will require that the corresponding invoice is + * paid before it can be drawn down from. + */ + fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) = + requireSuccessfulPayment(JsonField.of(requireSuccessfulPayment)) + + /** + * If true, the new credit block will require that the corresponding invoice is + * paid before it can be drawn down from. + */ + fun requireSuccessfulPayment(requireSuccessfulPayment: JsonField) = + apply { + this.requireSuccessfulPayment = requireSuccessfulPayment + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoiceSettings = + InvoiceSettings( + checkRequired("autoCollection", autoCollection), + checkRequired("netTerms", netTerms), + memo, + requireSuccessfulPayment, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InvoiceSettings && autoCollection == other.autoCollection && netTerms == other.netTerms && memo == other.memo && requireSuccessfulPayment == other.requireSuccessfulPayment && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(autoCollection, netTerms, memo, requireSuccessfulPayment, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoiceSettings{autoCollection=$autoCollection, netTerms=$netTerms, memo=$memo, requireSuccessfulPayment=$requireSuccessfulPayment, additionalProperties=$additionalProperties}" + } /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - - /** - * Can only be specified when entry_type=increment. How much, in the customer's - * currency, a customer paid for a single credit in this block - */ - fun perUnitCostBasis(perUnitCostBasis: String?) = - perUnitCostBasis(JsonField.ofNullable(perUnitCostBasis)) + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** - * Can only be specified when entry_type=increment. How much, in the customer's - * currency, a customer paid for a single credit in this block - */ - fun perUnitCostBasis(perUnitCostBasis: Optional) = - perUnitCostBasis(perUnitCostBasis.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * Can only be specified when entry_type=increment. How much, in the customer's - * currency, a customer paid for a single credit in this block - */ - fun perUnitCostBasis(perUnitCostBasis: JsonField) = apply { - this.perUnitCostBasis = perUnitCostBasis - } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + validated = true + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + @JvmStatic fun builder() = Builder() + } - fun build(): AddIncrementCreditLedgerEntryRequestParams = - AddIncrementCreditLedgerEntryRequestParams( - checkRequired("amount", amount), - checkRequired("entryType", entryType), - currency, - description, - effectiveDate, - expiryDate, - invoiceSettings, - metadata, - perUnitCostBasis, - additionalProperties.toImmutable(), - ) - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - companion object { + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JvmField val INCREMENT = of("increment") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** An enum containing [EntryType]'s known values. */ - enum class Known { - INCREMENT, - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * 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, - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + return /* spotless:off */ other is AddIncrementCreditLedgerEntryRequestParams && amount == other.amount && entryType == other.entryType && currency == other.currency && description == other.description && effectiveDate == other.effectiveDate && expiryDate == other.expiryDate && invoiceSettings == other.invoiceSettings && metadata == other.metadata && perUnitCostBasis == other.perUnitCostBasis && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, entryType, currency, description, effectiveDate, expiryDate, invoiceSettings, metadata, perUnitCostBasis, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - override fun toString() = value.toString() + override fun toString() = + "AddIncrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, effectiveDate=$effectiveDate, expiryDate=$expiryDate, invoiceSettings=$invoiceSettings, metadata=$metadata, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}" } - /** - * Passing `invoice_settings` automatically generates an invoice for the newly added - * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the - * calculation of the invoice total is done on that basis. - */ @NoAutoDetect - class InvoiceSettings + class AddDecrementCreditLedgerEntryRequestParams @JsonCreator private constructor( - @JsonProperty("auto_collection") + @JsonProperty("amount") @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("memo") + private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val memo: JsonField = JsonMissing.of(), - @JsonProperty("require_successful_payment") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("description") @ExcludeMissing - private val requireSuccessfulPayment: JsonField = JsonMissing.of(), + private val description: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { /** - * Whether the credits purchase invoice should auto collect with the customer's saved - * payment method. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - fun autoCollection(): Boolean = autoCollection.getRequired("auto_collection") + fun amount(): Double = amount.getRequired("amount") + + fun entryType(): EntryType = entryType.getRequired("entry_type") /** - * The net terms determines the difference between the invoice date and the issue date - * for the invoice. If you intend the invoice to be due on issue, set this to 0. + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - /** An optional memo to display on the invoice. */ - fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo")) + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** - * If true, the new credit block will require that the corresponding invoice is paid - * before it can be drawn down from. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun requireSuccessfulPayment(): Optional = - Optional.ofNullable( - requireSuccessfulPayment.getNullable("require_successful_payment") - ) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) /** - * Whether the credits purchase invoice should auto collect with the customer's saved - * payment method. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - @JsonProperty("auto_collection") + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + @JsonProperty("entry_type") @ExcludeMissing - fun _autoCollection(): JsonField = autoCollection + fun _entryType(): JsonField = entryType /** - * The net terms determines the difference between the invoice date and the issue date - * for the invoice. If you intend the invoice to be due on issue, set this to 0. + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - @JsonProperty("net_terms") @ExcludeMissing fun _netTerms(): JsonField = netTerms + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An optional memo to display on the invoice. */ - @JsonProperty("memo") @ExcludeMissing fun _memo(): JsonField = memo + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description /** - * If true, the new credit block will require that the corresponding invoice is paid - * before it can be drawn down from. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - @JsonProperty("require_successful_payment") + @JsonProperty("metadata") @ExcludeMissing - fun _requireSuccessfulPayment(): JsonField = requireSuccessfulPayment + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -1303,15 +1478,16 @@ private constructor( private var validated: Boolean = false - fun validate(): InvoiceSettings = apply { + fun validate(): AddDecrementCreditLedgerEntryRequestParams = apply { if (validated) { return@apply } - autoCollection() - netTerms() - memo() - requireSuccessfulPayment() + amount() + entryType() + currency() + description() + metadata().ifPresent { it.validate() } validated = true } @@ -1322,77 +1498,113 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InvoiceSettings]. */ + /** A builder for [AddDecrementCreditLedgerEntryRequestParams]. */ class Builder internal constructor() { - private var autoCollection: JsonField? = null - private var netTerms: JsonField? = null - private var memo: JsonField = JsonMissing.of() - private var requireSuccessfulPayment: JsonField = JsonMissing.of() + private var amount: JsonField? = null + private var entryType: JsonField? = null + private var currency: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(invoiceSettings: InvoiceSettings) = apply { - autoCollection = invoiceSettings.autoCollection - netTerms = invoiceSettings.netTerms - memo = invoiceSettings.memo - requireSuccessfulPayment = invoiceSettings.requireSuccessfulPayment - additionalProperties = invoiceSettings.additionalProperties.toMutableMap() + 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() } /** - * Whether the credits purchase invoice should auto collect with the customer's - * saved payment method. + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. */ - fun autoCollection(autoCollection: Boolean) = - autoCollection(JsonField.of(autoCollection)) + fun amount(amount: Double) = amount(JsonField.of(amount)) /** - * Whether the credits purchase invoice should auto collect with the customer's - * saved payment method. + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. */ - fun autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + + fun entryType(entryType: JsonField) = apply { + this.entryType = entryType } /** - * The net terms determines the difference between the invoice date and the issue - * date for the invoice. If you intend the invoice to be due on issue, set this - * to 0. + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun netTerms(netTerms: Long) = netTerms(JsonField.of(netTerms)) + fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) /** - * The net terms determines the difference between the invoice date and the issue - * date for the invoice. If you intend the invoice to be due on issue, set this - * to 0. + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } - - /** An optional memo to display on the invoice. */ - fun memo(memo: String?) = memo(JsonField.ofNullable(memo)) + fun currency(currency: Optional) = currency(currency.orElse(null)) - /** An optional memo to display on the invoice. */ - fun memo(memo: Optional) = memo(memo.orElse(null)) + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** An optional memo to display on the invoice. */ - fun memo(memo: JsonField) = apply { this.memo = memo } + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) /** - * If true, the new credit block will require that the corresponding invoice is paid - * before it can be drawn down from. + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. */ - fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) = - requireSuccessfulPayment(JsonField.of(requireSuccessfulPayment)) + fun description(description: Optional) = + description(description.orElse(null)) /** - * If true, the new credit block will require that the corresponding invoice is paid - * before it can be drawn down from. + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. */ - fun requireSuccessfulPayment(requireSuccessfulPayment: JsonField) = apply { - this.requireSuccessfulPayment = requireSuccessfulPayment + fun description(description: JsonField) = apply { + this.description = description } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1415,512 +1627,547 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InvoiceSettings = - InvoiceSettings( - checkRequired("autoCollection", autoCollection), - checkRequired("netTerms", netTerms), - memo, - requireSuccessfulPayment, + fun build(): AddDecrementCreditLedgerEntryRequestParams = + AddDecrementCreditLedgerEntryRequestParams( + checkRequired("amount", amount), + checkRequired("entryType", entryType), + currency, + description, + metadata, additionalProperties.toImmutable(), ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is InvoiceSettings && autoCollection == other.autoCollection && netTerms == other.netTerms && memo == other.memo && requireSuccessfulPayment == other.requireSuccessfulPayment && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(autoCollection, netTerms, memo, requireSuccessfulPayment, additionalProperties) } - /* spotless:on */ + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { - override fun hashCode(): Int = hashCode + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - override fun toString() = - "InvoiceSettings{autoCollection=$autoCollection, netTerms=$netTerms, memo=$memo, requireSuccessfulPayment=$requireSuccessfulPayment, additionalProperties=$additionalProperties}" - } + companion object { - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + @JvmField val DECREMENT = of("decrement") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) + } - private var validated: Boolean = false + /** An enum containing [EntryType]'s known values. */ + enum class Known { + DECREMENT + } - fun validate(): Metadata = apply { - if (validated) { - return@apply + /** + * 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, } - validated = true - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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 + } - fun toBuilder() = Builder().from(this) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to 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") + } - companion object { + fun asString(): String = _value().asStringOrThrow() - @JvmStatic fun builder() = Builder() - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + } - private var additionalProperties: MutableMap = mutableMapOf() + override fun hashCode() = value.hashCode() - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + override fun toString() = value.toString() + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + validated = true } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun toBuilder() = Builder().from(this) - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + private var additionalProperties: MutableMap = mutableMapOf() - override fun hashCode(): Int = hashCode + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - 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 */ - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, entryType, currency, description, effectiveDate, expiryDate, invoiceSettings, metadata, perUnitCostBasis, additionalProperties) } - /* spotless:on */ + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun hashCode(): Int = hashCode + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - override fun toString() = - "AddIncrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, effectiveDate=$effectiveDate, expiryDate=$expiryDate, invoiceSettings=$invoiceSettings, metadata=$metadata, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}" - } + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - @NoAutoDetect - class AddDecrementCreditLedgerEntryRequestParams - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(): Double = amount.getRequired("amount") - - fun entryType(): EntryType = entryType.getRequired("entry_type") - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - private var validated: Boolean = false + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - fun validate(): AddDecrementCreditLedgerEntryRequestParams = apply { - if (validated) { - return@apply + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - amount() - entryType() - currency() - description() - metadata().ifPresent { it.validate() } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + 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 */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, entryType, currency, description, metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - @JvmStatic fun builder() = Builder() + override fun toString() = + "AddDecrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } - /** A builder for [AddDecrementCreditLedgerEntryRequestParams]. */ - class Builder internal constructor() { + @NoAutoDetect + class AddExpirationChangeCreditLedgerEntryRequestParams + @JsonCreator + private constructor( + @JsonProperty("entry_type") + @ExcludeMissing + private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("expiry_date") + @ExcludeMissing + private val expiryDate: JsonField = JsonMissing.of(), + @JsonProperty("target_expiry_date") + @ExcludeMissing + private val targetExpiryDate: JsonField = JsonMissing.of(), + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("block_id") + @ExcludeMissing + private val blockId: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - private var amount: JsonField? = null - private var entryType: JsonField? = null - private var currency: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + fun entryType(): EntryType = entryType.getRequired("entry_type") - @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() - } + /** An ISO 8601 format date that identifies the origination credit block to expire */ + fun expiryDate(): Optional = + Optional.ofNullable(expiryDate.getNullable("expiry_date")) /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting + * when credits transferred (as part of a partial block expiration) should expire. */ - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun targetExpiryDate(): LocalDate = targetExpiryDate.getRequired("target_expiry_date") /** * The number of credits to effect. Note that this is required for increment, decrement, * void, or undo operations. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. + * The ID of the block affected by an expiration_change, used to differentiate between + * multiple blocks with the same `expiry_date`. */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun blockId(): Optional = Optional.ofNullable(blockId.getNullable("block_id")) /** * The currency or custom pricing unit to use for this ledger entry. If this is a * real-world currency, it must match the customer's invoicing currency. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) /** * Optional metadata that can be specified when adding ledger results via the API. For * example, this can be used to note an increment refers to trial credits, or for noting * corrections as a result of an incident, etc. */ - fun description(description: String?) = description(JsonField.ofNullable(description)) + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun description(description: Optional) = description(description.orElse(null)) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + @JsonProperty("entry_type") + @ExcludeMissing + fun _entryType(): JsonField = entryType + + /** An ISO 8601 format date that identifies the origination credit block to expire */ + @JsonProperty("expiry_date") + @ExcludeMissing + fun _expiryDate(): JsonField = expiryDate /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. + * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting + * when credits transferred (as part of a partial block expiration) should expire. */ - fun description(description: JsonField) = apply { - this.description = description - } + @JsonProperty("target_expiry_date") + @ExcludeMissing + fun _targetExpiryDate(): JsonField = targetExpiryDate /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * The ID of the block affected by an expiration_change, used to differentiate between + * multiple blocks with the same `expiry_date`. + */ + @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + private var validated: Boolean = false - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + fun validate(): AddExpirationChangeCreditLedgerEntryRequestParams = apply { + if (validated) { + return@apply + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + entryType() + expiryDate() + targetExpiryDate() + amount() + blockId() + currency() + description() + metadata().ifPresent { it.validate() } + validated = true } - fun build(): AddDecrementCreditLedgerEntryRequestParams = - AddDecrementCreditLedgerEntryRequestParams( - checkRequired("amount", amount), - checkRequired("entryType", entryType), - currency, - description, - metadata, - additionalProperties.toImmutable(), - ) - } + fun toBuilder() = Builder().from(this) - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmStatic fun builder() = Builder() + } - companion object { + /** A builder for [AddExpirationChangeCreditLedgerEntryRequestParams]. */ + class Builder internal constructor() { - @JvmField val DECREMENT = of("decrement") + private var entryType: JsonField? = null + private var expiryDate: JsonField? = null + private var targetExpiryDate: JsonField? = null + private var amount: JsonField = JsonMissing.of() + private var blockId: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } + @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() + } + + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + + fun entryType(entryType: JsonField) = apply { + this.entryType = entryType + } - /** An enum containing [EntryType]'s known values. */ - enum class Known { - DECREMENT, - } + /** + * An ISO 8601 format date that identifies the origination credit block to expire + */ + fun expiryDate(expiryDate: OffsetDateTime?) = + expiryDate(JsonField.ofNullable(expiryDate)) - /** - * 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. + * An ISO 8601 format date that identifies the origination credit block to expire */ - _UNKNOWN, - } + fun expiryDate(expiryDate: Optional) = + expiryDate(expiryDate.orElse(null)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 + /** + * An ISO 8601 format date that identifies the origination credit block to expire + */ + fun expiryDate(expiryDate: JsonField) = apply { + this.expiryDate = expiryDate } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") + /** + * A future date (specified in YYYY-MM-DD format) used for expiration change, + * denoting when credits transferred (as part of a partial block expiration) should + * expire. + */ + fun targetExpiryDate(targetExpiryDate: LocalDate) = + targetExpiryDate(JsonField.of(targetExpiryDate)) + + /** + * A future date (specified in YYYY-MM-DD format) used for expiration change, + * denoting when credits transferred (as part of a partial block expiration) should + * expire. + */ + fun targetExpiryDate(targetExpiryDate: JsonField) = apply { + this.targetExpiryDate = targetExpiryDate } - fun asString(): String = _value().asStringOrThrow() + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: Double?) = amount(JsonField.ofNullable(amount)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: Double) = amount(amount as Double?) - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun amount(amount: Optional) = amount(amount.orElse(null) as Double?) - override fun hashCode() = value.hashCode() + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } - override fun toString() = value.toString() - } + /** + * The ID of the block affected by an expiration_change, used to differentiate + * between multiple blocks with the same `expiry_date`. + */ + fun blockId(blockId: String?) = blockId(JsonField.ofNullable(blockId)) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * The ID of the block affected by an expiration_change, used to differentiate + * between multiple blocks with the same `expiry_date`. + */ + fun blockId(blockId: Optional) = blockId(blockId.orElse(null)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** + * The ID of the block affected by an expiration_change, used to differentiate + * between multiple blocks with the same `expiry_date`. + */ + fun blockId(blockId: JsonField) = apply { this.blockId = blockId } - private var validated: Boolean = false + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) - validated = true - } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - fun toBuilder() = Builder().from(this) + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) - companion object { + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: Optional) = + description(description.orElse(null)) - @JvmStatic fun builder() = Builder() - } + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: JsonField) = apply { + this.description = description + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1944,534 +2191,472 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + fun build(): AddExpirationChangeCreditLedgerEntryRequestParams = + AddExpirationChangeCreditLedgerEntryRequestParams( + checkRequired("entryType", entryType), + checkRequired("expiryDate", expiryDate), + checkRequired("targetExpiryDate", targetExpiryDate), + amount, + blockId, + currency, + description, + metadata, + additionalProperties.toImmutable(), + ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + 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)) } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** An enum containing [EntryType]'s known values. */ + enum class Known { + EXPIRATION_CHANGE + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * 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, + } - override fun hashCode(): Int = hashCode + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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 + } - override fun toString() = "Metadata{additionalProperties=$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) { + EXPIRATION_CHANGE -> Known.EXPIRATION_CHANGE + else -> throw OrbInvalidDataException("Unknown EntryType: $value") + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun asString(): String = _value().asStringOrThrow() + + 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() } - 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 */ - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, entryType, currency, description, metadata, additionalProperties) } - /* spotless:on */ + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun hashCode(): Int = hashCode + private var validated: Boolean = false - override fun toString() = - "AddDecrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - @NoAutoDetect - class AddExpirationChangeCreditLedgerEntryRequestParams - @JsonCreator - private constructor( - @JsonProperty("entry_type") - @ExcludeMissing - private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("expiry_date") - @ExcludeMissing - private val expiryDate: JsonField = JsonMissing.of(), - @JsonProperty("target_expiry_date") - @ExcludeMissing - private val targetExpiryDate: JsonField = JsonMissing.of(), - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("block_id") - @ExcludeMissing - private val blockId: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + validated = true + } - fun entryType(): EntryType = entryType.getRequired("entry_type") - - /** An ISO 8601 format date that identifies the origination credit block to expire */ - fun expiryDate(): Optional = - Optional.ofNullable(expiryDate.getNullable("expiry_date")) - - /** - * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting when - * credits transferred (as part of a partial block expiration) should expire. - */ - fun targetExpiryDate(): LocalDate = targetExpiryDate.getRequired("target_expiry_date") - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) - - /** - * The ID of the block affected by an expiration_change, used to differentiate between - * multiple blocks with the same `expiry_date`. - */ - fun blockId(): Optional = Optional.ofNullable(blockId.getNullable("block_id")) - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - - /** An ISO 8601 format date that identifies the origination credit block to expire */ - @JsonProperty("expiry_date") - @ExcludeMissing - fun _expiryDate(): JsonField = expiryDate - - /** - * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting when - * credits transferred (as part of a partial block expiration) should expire. - */ - @JsonProperty("target_expiry_date") - @ExcludeMissing - fun _targetExpiryDate(): JsonField = targetExpiryDate - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * The ID of the block affected by an expiration_change, used to differentiate between - * multiple blocks with the same `expiry_date`. - */ - @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): AddExpirationChangeCreditLedgerEntryRequestParams = apply { - if (validated) { - return@apply - } + @JvmStatic fun builder() = Builder() + } - entryType() - expiryDate() - targetExpiryDate() - amount() - blockId() - currency() - description() - metadata().ifPresent { it.validate() } - validated = true - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - fun toBuilder() = Builder().from(this) + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - @JvmStatic fun builder() = Builder() - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** A builder for [AddExpirationChangeCreditLedgerEntryRequestParams]. */ - class Builder internal constructor() { - - private var entryType: JsonField? = null - private var expiryDate: JsonField? = null - private var targetExpiryDate: JsonField? = null - private var amount: JsonField = JsonMissing.of() - private var blockId: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** An ISO 8601 format date that identifies the origination credit block to expire */ - fun expiryDate(expiryDate: OffsetDateTime?) = - expiryDate(JsonField.ofNullable(expiryDate)) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** An ISO 8601 format date that identifies the origination credit block to expire */ - fun expiryDate(expiryDate: Optional) = - expiryDate(expiryDate.orElse(null)) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** An ISO 8601 format date that identifies the origination credit block to expire */ - fun expiryDate(expiryDate: JsonField) = apply { - this.expiryDate = expiryDate - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting - * when credits transferred (as part of a partial block expiration) should expire. - */ - fun targetExpiryDate(targetExpiryDate: LocalDate) = - targetExpiryDate(JsonField.of(targetExpiryDate)) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting - * when credits transferred (as part of a partial block expiration) should expire. - */ - fun targetExpiryDate(targetExpiryDate: JsonField) = apply { - this.targetExpiryDate = targetExpiryDate - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(amount: Double?) = amount(JsonField.ofNullable(amount)) + override fun hashCode(): Int = hashCode - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(amount: Double) = amount(amount as Double?) + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Double?) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } + 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 */ + } - /** - * The ID of the block affected by an expiration_change, used to differentiate between - * multiple blocks with the same `expiry_date`. - */ - fun blockId(blockId: String?) = blockId(JsonField.ofNullable(blockId)) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(entryType, expiryDate, targetExpiryDate, amount, blockId, currency, description, metadata, additionalProperties) } + /* spotless:on */ - /** - * The ID of the block affected by an expiration_change, used to differentiate between - * multiple blocks with the same `expiry_date`. - */ - fun blockId(blockId: Optional) = blockId(blockId.orElse(null)) + override fun hashCode(): Int = hashCode - /** - * The ID of the block affected by an expiration_change, used to differentiate between - * multiple blocks with the same `expiry_date`. - */ - fun blockId(blockId: JsonField) = apply { this.blockId = blockId } + override fun toString() = + "AddExpirationChangeCreditLedgerEntryRequestParams{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" + } + + @NoAutoDetect + class AddVoidCreditLedgerEntryRequestParams + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("block_id") + @ExcludeMissing + private val blockId: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") + @ExcludeMissing + private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("void_reason") + @ExcludeMissing + private val voidReason: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + fun amount(): Double = amount.getRequired("amount") - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + /** The ID of the block to void. */ + fun blockId(): String = blockId.getRequired("block_id") + + fun entryType(): EntryType = entryType.getRequired("entry_type") /** * The currency or custom pricing unit to use for this ledger entry. If this is a * real-world currency, it must match the customer's invoicing currency. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) /** * Optional metadata that can be specified when adding ledger results via the API. For * example, this can be used to note an increment refers to trial credits, or for noting * corrections as a result of an incident, etc. */ - fun description(description: String?) = description(JsonField.ofNullable(description)) + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun description(description: Optional) = description(description.orElse(null)) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** Can only be specified when `entry_type=void`. The reason for the void. */ + fun voidReason(): Optional = + Optional.ofNullable(voidReason.getNullable("void_reason")) /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - fun description(description: JsonField) = apply { - this.description = description - } + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** The ID of the block to void. */ + @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId + + @JsonProperty("entry_type") + @ExcludeMissing + fun _entryType(): JsonField = entryType /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** Can only be specified when `entry_type=void`. The reason for the void. */ + @JsonProperty("void_reason") + @ExcludeMissing + fun _voidReason(): JsonField = voidReason - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + private var validated: Boolean = false - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + fun validate(): AddVoidCreditLedgerEntryRequestParams = apply { + if (validated) { + return@apply + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + amount() + blockId() + entryType() + currency() + description() + metadata().ifPresent { it.validate() } + voidReason() + validated = true } - fun build(): AddExpirationChangeCreditLedgerEntryRequestParams = - AddExpirationChangeCreditLedgerEntryRequestParams( - checkRequired("entryType", entryType), - checkRequired("expiryDate", expiryDate), - checkRequired("targetExpiryDate", targetExpiryDate), - amount, - blockId, - currency, - description, - metadata, - additionalProperties.toImmutable(), - ) - } + fun toBuilder() = Builder().from(this) - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmStatic fun builder() = Builder() + } - companion object { + /** A builder for [AddVoidCreditLedgerEntryRequestParams]. */ + class Builder internal constructor() { - @JvmField val EXPIRATION_CHANGE = of("expiration_change") + private var amount: JsonField? = null + private var blockId: JsonField? = null + private var entryType: JsonField? = null + private var currency: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var voidReason: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } + @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() + } - /** An enum containing [EntryType]'s known values. */ - enum class Known { - EXPIRATION_CHANGE, - } + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: Double) = amount(JsonField.of(amount)) - /** - * 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. + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. */ - _UNKNOWN, - } + fun amount(amount: JsonField) = apply { this.amount = amount } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 - } + /** The ID of the block to void. */ + fun blockId(blockId: String) = blockId(JsonField.of(blockId)) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") - } + /** The ID of the block to void. */ + fun blockId(blockId: JsonField) = apply { this.blockId = blockId } - fun asString(): String = _value().asStringOrThrow() + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun entryType(entryType: JsonField) = apply { + this.entryType = entryType } - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - override fun toString() = value.toString() - } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) - private var validated: Boolean = false + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: Optional) = + description(description.orElse(null)) - fun validate(): Metadata = apply { - if (validated) { - return@apply + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: JsonField) = apply { + this.description = description } - validated = true - } - - fun toBuilder() = Builder().from(this) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - companion object { + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - @JvmStatic fun builder() = Builder() - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** Can only be specified when `entry_type=void`. The reason for the void. */ + fun voidReason(voidReason: VoidReason?) = + voidReason(JsonField.ofNullable(voidReason)) - private var additionalProperties: MutableMap = mutableMapOf() + /** Can only be specified when `entry_type=void`. The reason for the void. */ + fun voidReason(voidReason: Optional) = + voidReason(voidReason.orElse(null)) - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() + /** Can only be specified when `entry_type=void`. The reason for the void. */ + fun voidReason(voidReason: JsonField) = apply { + this.voidReason = voidReason } fun additionalProperties(additionalProperties: Map) = apply { @@ -2496,432 +2681,392 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + fun build(): AddVoidCreditLedgerEntryRequestParams = + AddVoidCreditLedgerEntryRequestParams( + checkRequired("amount", amount), + checkRequired("blockId", blockId), + checkRequired("entryType", entryType), + currency, + description, + metadata, + voidReason, + additionalProperties.toImmutable(), + ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmField val VOID = of("void") - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** An enum containing [EntryType]'s known values. */ + enum class Known { + VOID + } - 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 */ - } + /** + * 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, + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(entryType, expiryDate, targetExpiryDate, amount, blockId, currency, description, metadata, additionalProperties) } - /* spotless:on */ + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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 + } - override fun hashCode(): Int = hashCode + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to 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") + } - override fun toString() = - "AddExpirationChangeCreditLedgerEntryRequestParams{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" - } + fun asString(): String = _value().asStringOrThrow() - @NoAutoDetect - class AddVoidCreditLedgerEntryRequestParams - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("block_id") - @ExcludeMissing - private val blockId: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonProperty("void_reason") - @ExcludeMissing - private val voidReason: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(): Double = amount.getRequired("amount") - - /** The ID of the block to void. */ - fun blockId(): String = blockId.getRequired("block_id") - - fun entryType(): EntryType = entryType.getRequired("entry_type") - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** Can only be specified when `entry_type=void`. The reason for the void. */ - fun voidReason(): Optional = - Optional.ofNullable(voidReason.getNullable("void_reason")) - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** The ID of the block to void. */ - @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId - - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - /** Can only be specified when `entry_type=void`. The reason for the void. */ - @JsonProperty("void_reason") - @ExcludeMissing - fun _voidReason(): JsonField = voidReason - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + } - private var validated: Boolean = false + override fun hashCode() = value.hashCode() - fun validate(): AddVoidCreditLedgerEntryRequestParams = apply { - if (validated) { - return@apply + override fun toString() = value.toString() } - amount() - blockId() - entryType() - currency() - description() - metadata().ifPresent { it.validate() } - voidReason() - validated = true - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - fun toBuilder() = Builder().from(this) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - companion object { + private var validated: Boolean = false - @JvmStatic fun builder() = Builder() - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - /** A builder for [AddVoidCreditLedgerEntryRequestParams]. */ - class Builder internal constructor() { + validated = true + } - private var amount: JsonField? = null - private var blockId: JsonField? = null - private var entryType: JsonField? = null - private var currency: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - private var voidReason: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + fun toBuilder() = Builder().from(this) - @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() - } + companion object { - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(amount: Double) = amount(JsonField.of(amount)) + @JvmStatic fun builder() = Builder() + } - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** The ID of the block to void. */ - fun blockId(blockId: String) = blockId(JsonField.of(blockId)) + private var additionalProperties: MutableMap = mutableMapOf() - /** The ID of the block to void. */ - fun blockId(blockId: JsonField) = apply { this.blockId = blockId } + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: String?) = description(JsonField.ofNullable(description)) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: Optional) = description(description.orElse(null)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: JsonField) = apply { - this.description = description + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** Can only be specified when `entry_type=void`. The reason for the void. */ + class VoidReason + @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`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val REFUND = of("refund") + + @JvmStatic fun of(value: String) = VoidReason(JsonField.of(value)) + } + + /** An enum containing [VoidReason]'s known values. */ + enum class Known { + REFUND + } + + /** + * An enum containing [VoidReason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [VoidReason] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + REFUND, + /** + * An enum member indicating that [VoidReason] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + REFUND -> Value.REFUND + else -> Value._UNKNOWN + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + REFUND -> Known.REFUND + else -> throw OrbInvalidDataException("Unknown VoidReason: $value") + } - /** Can only be specified when `entry_type=void`. The reason for the void. */ - fun voidReason(voidReason: VoidReason?) = voidReason(JsonField.ofNullable(voidReason)) + fun asString(): String = _value().asStringOrThrow() - /** Can only be specified when `entry_type=void`. The reason for the void. */ - fun voidReason(voidReason: Optional) = voidReason(voidReason.orElse(null)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** Can only be specified when `entry_type=void`. The reason for the void. */ - fun voidReason(voidReason: JsonField) = apply { - this.voidReason = voidReason - } + return /* spotless:off */ other is VoidReason && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + 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 */ } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, blockId, entryType, currency, description, metadata, voidReason, additionalProperties) } + /* spotless:on */ - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode(): Int = hashCode - fun build(): AddVoidCreditLedgerEntryRequestParams = - AddVoidCreditLedgerEntryRequestParams( - checkRequired("amount", amount), - checkRequired("blockId", blockId), - checkRequired("entryType", entryType), - currency, - description, - metadata, - voidReason, - additionalProperties.toImmutable(), - ) + override fun toString() = + "AddVoidCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, voidReason=$voidReason, additionalProperties=$additionalProperties}" } - class EntryType + @NoAutoDetect + class AddAmendmentCreditLedgerEntryRequestParams @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("block_id") + @ExcludeMissing + private val blockId: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") + @ExcludeMissing + private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. + * The number of credits to effect. Note that this is required for increment, decrement + * or void operations. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun amount(): Double = amount.getRequired("amount") - companion object { - - @JvmField val VOID = of("void") - - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } + /** The ID of the block to reverse a decrement from. */ + fun blockId(): String = blockId.getRequired("block_id") - /** An enum containing [EntryType]'s known values. */ - enum class Known { - VOID, - } + fun entryType(): EntryType = entryType.getRequired("entry_type") /** - * 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. + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - enum class Value { - VOID, - /** - * An enum member indicating that [EntryType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. */ - fun value(): Value = - when (this) { - VOID -> Value.VOID - else -> Value._UNKNOWN - } + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun known(): Known = - when (this) { - VOID -> Known.VOID - else -> throw OrbInvalidDataException("Unknown EntryType: $value") - } + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - fun asString(): String = _value().asStringOrThrow() + /** + * The number of credits to effect. Note that this is required for increment, decrement + * or void operations. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The ID of the block to reverse a decrement from. */ + @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } + @JsonProperty("entry_type") + @ExcludeMissing + fun _entryType(): JsonField = entryType - override fun hashCode() = value.hashCode() + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - override fun toString() = value.toString() - } + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -2929,11 +3074,17 @@ private constructor( private var validated: Boolean = false - fun validate(): Metadata = apply { + fun validate(): AddAmendmentCreditLedgerEntryRequestParams = apply { if (validated) { return@apply } + amount() + blockId() + entryType() + currency() + description() + metadata().ifPresent { it.validate() } validated = true } @@ -2944,373 +3095,239 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Metadata]. */ + /** A builder for [AddAmendmentCreditLedgerEntryRequestParams]. */ class Builder internal constructor() { + private var amount: JsonField? = null + private var blockId: JsonField? = null + private var entryType: JsonField? = null + private var currency: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() 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) + 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() } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * The number of credits to effect. Note that this is required for increment, + * decrement or void operations. + */ + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** + * The number of credits to effect. Note that this is required for increment, + * decrement or void operations. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** The ID of the block to reverse a decrement from. */ + fun blockId(blockId: String) = blockId(JsonField.of(blockId)) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** The ID of the block to reverse a decrement from. */ + fun blockId(blockId: JsonField) = apply { this.blockId = blockId } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun entryType(entryType: JsonField) = apply { + this.entryType = entryType } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) - /** Can only be specified when `entry_type=void`. The reason for the void. */ - class VoidReason - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) - companion object { + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: Optional) = + description(description.orElse(null)) - @JvmField val REFUND = of("refund") + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: JsonField) = apply { + this.description = description + } - @JvmStatic fun of(value: String) = VoidReason(JsonField.of(value)) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** An enum containing [VoidReason]'s known values. */ - enum class Known { - REFUND, - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** - * An enum containing [VoidReason]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [VoidReason] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - REFUND, /** - * An enum member indicating that [VoidReason] was instantiated with an unknown - * value. + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - _UNKNOWN, - } + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - REFUND -> Value.REFUND - else -> Value._UNKNOWN + 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) { - REFUND -> Known.REFUND - else -> throw OrbInvalidDataException("Unknown VoidReason: $value") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - fun asString(): String = _value().asStringOrThrow() + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - return /* spotless:off */ other is VoidReason && 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 AddVoidCreditLedgerEntryRequestParams && amount == other.amount && blockId == other.blockId && entryType == other.entryType && currency == other.currency && description == other.description && metadata == other.metadata && voidReason == other.voidReason && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, blockId, entryType, currency, description, metadata, voidReason, additionalProperties) } - /* spotless:on */ - - 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}" - } - - @NoAutoDetect - class AddAmendmentCreditLedgerEntryRequestParams - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("block_id") - @ExcludeMissing - private val blockId: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * The number of credits to effect. Note that this is required for increment, decrement or - * void operations. - */ - fun amount(): Double = amount.getRequired("amount") - - /** The ID of the block to reverse a decrement from. */ - fun blockId(): String = blockId.getRequired("block_id") - - fun entryType(): EntryType = entryType.getRequired("entry_type") - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** - * The number of credits to effect. Note that this is required for increment, decrement or - * void operations. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** The ID of the block to reverse a decrement from. */ - @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId - - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun validate(): AddAmendmentCreditLedgerEntryRequestParams = apply { - if (validated) { - return@apply + fun build(): AddAmendmentCreditLedgerEntryRequestParams = + AddAmendmentCreditLedgerEntryRequestParams( + checkRequired("amount", amount), + checkRequired("blockId", blockId), + checkRequired("entryType", entryType), + currency, + description, + metadata, + additionalProperties.toImmutable(), + ) } - amount() - blockId() - entryType() - currency() - description() - metadata().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AddAmendmentCreditLedgerEntryRequestParams]. */ - class Builder internal constructor() { - - private var amount: JsonField? = null - private var blockId: JsonField? = null - private var entryType: JsonField? = null - private var currency: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { - @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() - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * The number of credits to effect. Note that this is required for increment, decrement - * or void operations. - */ - fun amount(amount: Double) = amount(JsonField.of(amount)) + companion object { - /** - * The number of credits to effect. Note that this is required for increment, decrement - * or void operations. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } + @JvmField val AMENDMENT = of("amendment") - /** The ID of the block to reverse a decrement from. */ - fun blockId(blockId: String) = blockId(JsonField.of(blockId)) + @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) + } - /** The ID of the block to reverse a decrement from. */ - fun blockId(blockId: JsonField) = apply { this.blockId = blockId } + /** An enum containing [EntryType]'s known values. */ + enum class Known { + AMENDMENT + } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /** + * 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, + } - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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 + } - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to 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") + } - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun asString(): String = _value().asStringOrThrow() - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: String?) = description(JsonField.ofNullable(description)) + return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + } - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: Optional) = description(description.orElse(null)) + override fun hashCode() = value.hashCode() - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: JsonField) = apply { - this.description = description + override fun toString() = value.toString() } /** @@ -3318,244 +3335,320 @@ private constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + validated = true + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + @JvmStatic fun builder() = Builder() + } - fun build(): AddAmendmentCreditLedgerEntryRequestParams = - AddAmendmentCreditLedgerEntryRequestParams( - checkRequired("amount", amount), - checkRequired("blockId", blockId), - checkRequired("entryType", entryType), - currency, - description, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - companion object { + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JvmField val AMENDMENT = of("amendment") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** An enum containing [EntryType]'s known values. */ - enum class Known { - AMENDMENT, - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * 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, - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + return /* spotless:off */ other is AddAmendmentCreditLedgerEntryRequestParams && amount == other.amount && blockId == other.blockId && entryType == other.entryType && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, blockId, entryType, currency, description, metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - override fun toString() = value.toString() + override fun toString() = + "AddAmendmentCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun toBuilder() = Builder().from(this) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + companion object { - private var validated: Boolean = false + @JvmStatic fun builder() = Builder() + } - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + /** A builder for [CustomerCreditLedgerCreateEntryByExternalIdParams]. */ + @NoAutoDetect + class Builder internal constructor() { - validated = true - } + private var externalCustomerId: String? = null + private var body: Body? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - fun toBuilder() = Builder().from(this) + @JvmSynthetic + internal fun from( + customerCreditLedgerCreateEntryByExternalIdParams: + CustomerCreditLedgerCreateEntryByExternalIdParams + ) = apply { + externalCustomerId = + customerCreditLedgerCreateEntryByExternalIdParams.externalCustomerId + body = customerCreditLedgerCreateEntryByExternalIdParams.body + additionalHeaders = + customerCreditLedgerCreateEntryByExternalIdParams.additionalHeaders.toBuilder() + additionalQueryParams = + customerCreditLedgerCreateEntryByExternalIdParams.additionalQueryParams.toBuilder() + } - companion object { + fun externalCustomerId(externalCustomerId: String) = apply { + this.externalCustomerId = externalCustomerId + } - @JvmStatic fun builder() = Builder() - } + fun body(body: Body) = apply { this.body = body } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun body( + addIncrementCreditLedgerEntryRequestParams: + Body.AddIncrementCreditLedgerEntryRequestParams + ) = + body( + Body.ofAddIncrementCreditLedgerEntryRequestParams( + addIncrementCreditLedgerEntryRequestParams + ) + ) - private var additionalProperties: MutableMap = mutableMapOf() + fun addIncrementCreditLedgerEntryRequestParamsBody(amount: Double) = + body( + Body.AddIncrementCreditLedgerEntryRequestParams.builder() + .entryType( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .EntryType + .INCREMENT + ) + .amount(amount) + .build() + ) - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + fun body( + addDecrementCreditLedgerEntryRequestParams: + Body.AddDecrementCreditLedgerEntryRequestParams + ) = + body( + Body.ofAddDecrementCreditLedgerEntryRequestParams( + addDecrementCreditLedgerEntryRequestParams + ) + ) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun addDecrementCreditLedgerEntryRequestParamsBody(amount: Double) = + body( + Body.AddDecrementCreditLedgerEntryRequestParams.builder() + .entryType( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body + .AddDecrementCreditLedgerEntryRequestParams + .EntryType + .DECREMENT + ) + .amount(amount) + .build() + ) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun body( + addExpirationChangeCreditLedgerEntryRequestParams: + Body.AddExpirationChangeCreditLedgerEntryRequestParams + ) = + body( + Body.ofAddExpirationChangeCreditLedgerEntryRequestParams( + addExpirationChangeCreditLedgerEntryRequestParams + ) + ) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun body( + addVoidCreditLedgerEntryRequestParams: Body.AddVoidCreditLedgerEntryRequestParams + ) = + body( + Body.ofAddVoidCreditLedgerEntryRequestParams(addVoidCreditLedgerEntryRequestParams) + ) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + fun body( + addAmendmentCreditLedgerEntryRequestParams: + Body.AddAmendmentCreditLedgerEntryRequestParams + ) = + body( + Body.ofAddAmendmentCreditLedgerEntryRequestParams( + addAmendmentCreditLedgerEntryRequestParams + ) + ) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - override fun hashCode(): Int = hashCode + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) } - 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 */ + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, blockId, entryType, currency, description, metadata, additionalProperties) } - /* spotless:on */ + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - override fun hashCode(): Int = hashCode + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } - override fun toString() = - "AddAmendmentCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" + fun build(): CustomerCreditLedgerCreateEntryByExternalIdParams = + CustomerCreditLedgerCreateEntryByExternalIdParams( + checkRequired("externalCustomerId", externalCustomerId), + checkRequired("body", body), + additionalHeaders.build(), + additionalQueryParams.build(), + ) } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponse.kt index 82bae509..643f0a5e 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 @@ -307,7 +307,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryByExternalIdResponse( incrementLedgerEntry = it, - _json = json + _json = json, ) } } @@ -316,7 +316,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryByExternalIdResponse( decrementLedgerEntry = it, - _json = json + _json = json, ) } } @@ -327,7 +327,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryByExternalIdResponse( expirationChangeLedgerEntry = it, - _json = json + _json = json, ) } } @@ -338,7 +338,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryByExternalIdResponse( creditBlockExpiryLedgerEntry = it, - _json = json + _json = json, ) } } @@ -347,7 +347,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryByExternalIdResponse( voidLedgerEntry = it, - _json = json + _json = json, ) } } @@ -358,7 +358,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryByExternalIdResponse( voidInitiatedLedgerEntry = it, - _json = json + _json = json, ) } } @@ -367,7 +367,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryByExternalIdResponse( amendmentLedgerEntry = it, - _json = json + _json = json, ) } } @@ -385,7 +385,7 @@ private constructor( override fun serialize( value: CustomerCreditLedgerCreateEntryByExternalIdResponse, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.incrementLedgerEntry != null -> @@ -995,11 +995,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1090,11 +1087,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1115,7 +1109,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - INCREMENT, + INCREMENT } /** @@ -1189,7 +1183,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -1919,11 +1913,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2014,11 +2005,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2039,7 +2027,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - DECREMENT, + DECREMENT } /** @@ -2113,7 +2101,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -2817,11 +2805,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2912,11 +2897,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2937,7 +2919,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - EXPIRATION_CHANGE, + EXPIRATION_CHANGE } /** @@ -3011,7 +2993,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -3691,11 +3673,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3786,11 +3765,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3811,7 +3787,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - CREDIT_BLOCK_EXPIRY, + CREDIT_BLOCK_EXPIRY } /** @@ -3885,7 +3861,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -4601,11 +4577,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4696,11 +4669,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4721,7 +4691,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - VOID, + VOID } /** @@ -4795,7 +4765,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -5532,11 +5502,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5627,11 +5594,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5652,7 +5616,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - VOID_INITIATED, + VOID_INITIATED } /** @@ -5726,7 +5690,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6405,11 +6369,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6500,11 +6461,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6525,7 +6483,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - AMENDMENT, + AMENDMENT } /** @@ -6599,7 +6557,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 3ad0a041..31179ed5 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 @@ -140,37 +140,20 @@ import kotlin.jvm.optionals.getOrNull class CustomerCreditLedgerCreateEntryParams private constructor( private val customerId: String, - private val body: CustomerCreditLedgerCreateEntryBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { fun customerId(): String = customerId - fun addIncrementCreditLedgerEntryRequestParams(): - Optional = - body.addIncrementCreditLedgerEntryRequestParams() - - fun addDecrementCreditLedgerEntryRequestParams(): - Optional = - body.addDecrementCreditLedgerEntryRequestParams() - - fun addExpirationChangeCreditLedgerEntryRequestParams(): - Optional = - body.addExpirationChangeCreditLedgerEntryRequestParams() - - fun addVoidCreditLedgerEntryRequestParams(): Optional = - body.addVoidCreditLedgerEntryRequestParams() - - fun addAmendmentCreditLedgerEntryRequestParams(): - Optional = - body.addAmendmentCreditLedgerEntryRequestParams() + fun body(): Body = body fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): CustomerCreditLedgerCreateEntryBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -183,10 +166,10 @@ private constructor( } } - @JsonDeserialize(using = CustomerCreditLedgerCreateEntryBody.Deserializer::class) - @JsonSerialize(using = CustomerCreditLedgerCreateEntryBody.Serializer::class) - class CustomerCreditLedgerCreateEntryBody - internal constructor( + @JsonDeserialize(using = Body.Deserializer::class) + @JsonSerialize(using = Body.Serializer::class) + class Body + private constructor( private val addIncrementCreditLedgerEntryRequestParams: AddIncrementCreditLedgerEntryRequestParams? = null, @@ -296,12 +279,59 @@ private constructor( } } + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitAddIncrementCreditLedgerEntryRequestParams( + addIncrementCreditLedgerEntryRequestParams: + AddIncrementCreditLedgerEntryRequestParams + ) { + addIncrementCreditLedgerEntryRequestParams.validate() + } + + override fun visitAddDecrementCreditLedgerEntryRequestParams( + addDecrementCreditLedgerEntryRequestParams: + AddDecrementCreditLedgerEntryRequestParams + ) { + addDecrementCreditLedgerEntryRequestParams.validate() + } + + override fun visitAddExpirationChangeCreditLedgerEntryRequestParams( + addExpirationChangeCreditLedgerEntryRequestParams: + AddExpirationChangeCreditLedgerEntryRequestParams + ) { + addExpirationChangeCreditLedgerEntryRequestParams.validate() + } + + override fun visitAddVoidCreditLedgerEntryRequestParams( + addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams + ) { + addVoidCreditLedgerEntryRequestParams.validate() + } + + override fun visitAddAmendmentCreditLedgerEntryRequestParams( + addAmendmentCreditLedgerEntryRequestParams: + AddAmendmentCreditLedgerEntryRequestParams + ) { + addAmendmentCreditLedgerEntryRequestParams.validate() + } + } + ) + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditLedgerCreateEntryBody && addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams /* spotless:on */ + return /* spotless:off */ other is Body && addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams /* spotless:on */ } override fun hashCode(): Int = /* spotless:off */ Objects.hash(addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams) /* spotless:on */ @@ -309,17 +339,17 @@ private constructor( override fun toString(): String = when { addIncrementCreditLedgerEntryRequestParams != null -> - "CustomerCreditLedgerCreateEntryBody{addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams}" + "Body{addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams}" addDecrementCreditLedgerEntryRequestParams != null -> - "CustomerCreditLedgerCreateEntryBody{addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams}" + "Body{addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams}" addExpirationChangeCreditLedgerEntryRequestParams != null -> - "CustomerCreditLedgerCreateEntryBody{addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams}" + "Body{addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams}" addVoidCreditLedgerEntryRequestParams != null -> - "CustomerCreditLedgerCreateEntryBody{addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams}" + "Body{addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams}" addAmendmentCreditLedgerEntryRequestParams != null -> - "CustomerCreditLedgerCreateEntryBody{addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams}" - _json != null -> "CustomerCreditLedgerCreateEntryBody{_unknown=$_json}" - else -> throw IllegalStateException("Invalid CustomerCreditLedgerCreateEntryBody") + "Body{addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams}" + _json != null -> "Body{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Body") } companion object { @@ -329,7 +359,7 @@ private constructor( addIncrementCreditLedgerEntryRequestParams: AddIncrementCreditLedgerEntryRequestParams ) = - CustomerCreditLedgerCreateEntryBody( + Body( addIncrementCreditLedgerEntryRequestParams = addIncrementCreditLedgerEntryRequestParams ) @@ -339,7 +369,7 @@ private constructor( addDecrementCreditLedgerEntryRequestParams: AddDecrementCreditLedgerEntryRequestParams ) = - CustomerCreditLedgerCreateEntryBody( + Body( addDecrementCreditLedgerEntryRequestParams = addDecrementCreditLedgerEntryRequestParams ) @@ -349,7 +379,7 @@ private constructor( addExpirationChangeCreditLedgerEntryRequestParams: AddExpirationChangeCreditLedgerEntryRequestParams ) = - CustomerCreditLedgerCreateEntryBody( + Body( addExpirationChangeCreditLedgerEntryRequestParams = addExpirationChangeCreditLedgerEntryRequestParams ) @@ -357,26 +387,20 @@ private constructor( @JvmStatic fun ofAddVoidCreditLedgerEntryRequestParams( addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ) = - CustomerCreditLedgerCreateEntryBody( - addVoidCreditLedgerEntryRequestParams = addVoidCreditLedgerEntryRequestParams - ) + ) = Body(addVoidCreditLedgerEntryRequestParams = addVoidCreditLedgerEntryRequestParams) @JvmStatic fun ofAddAmendmentCreditLedgerEntryRequestParams( addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams ) = - CustomerCreditLedgerCreateEntryBody( + Body( addAmendmentCreditLedgerEntryRequestParams = addAmendmentCreditLedgerEntryRequestParams ) } - /** - * An interface that defines how to map each variant of - * [CustomerCreditLedgerCreateEntryBody] to a value of type [T]. - */ + /** An interface that defines how to map each variant of [Body] to a value of type [T]. */ interface Visitor { fun visitAddIncrementCreditLedgerEntryRequestParams( @@ -404,29 +428,22 @@ private constructor( ): T /** - * Maps an unknown variant of [CustomerCreditLedgerCreateEntryBody] to a value of type - * [T]. + * Maps an unknown variant of [Body] to a value of type [T]. * - * An instance of [CustomerCreditLedgerCreateEntryBody] can contain an unknown variant - * if it was deserialized from data that doesn't match any known variant. For example, - * if the SDK is on an older version than the API, then the API may respond with new - * variants that the SDK is unaware of. + * An instance of [Body] can contain an unknown variant if it was deserialized from data + * that doesn't match any known variant. For example, if the SDK is on an older version + * than the API, then the API may respond with new variants that the SDK is unaware of. * * @throws OrbInvalidDataException in the default implementation. */ fun unknown(json: JsonValue?): T { - throw OrbInvalidDataException("Unknown CustomerCreditLedgerCreateEntryBody: $json") + throw OrbInvalidDataException("Unknown Body: $json") } } - internal class Deserializer : - BaseDeserializer( - CustomerCreditLedgerCreateEntryBody::class - ) { + internal class Deserializer : BaseDeserializer(Body::class) { - override fun ObjectCodec.deserialize( - node: JsonNode - ): CustomerCreditLedgerCreateEntryBody { + override fun ObjectCodec.deserialize(node: JsonNode): Body { val json = JsonValue.fromJsonNode(node) val entryType = json.asObject().getOrNull()?.get("entry_type")?.asString()?.getOrNull() @@ -435,78 +452,85 @@ private constructor( "increment" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return CustomerCreditLedgerCreateEntryBody( + return Body( addIncrementCreditLedgerEntryRequestParams = it, - _json = json + _json = json, ) } } "decrement" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return CustomerCreditLedgerCreateEntryBody( + return Body( addDecrementCreditLedgerEntryRequestParams = it, - _json = json + _json = json, ) } } "expiration_change" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return CustomerCreditLedgerCreateEntryBody( + return Body( addExpirationChangeCreditLedgerEntryRequestParams = it, - _json = json + _json = json, ) } } "void" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return CustomerCreditLedgerCreateEntryBody( + return Body( addVoidCreditLedgerEntryRequestParams = it, - _json = json + _json = json, ) } } "amendment" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return CustomerCreditLedgerCreateEntryBody( + return Body( addAmendmentCreditLedgerEntryRequestParams = it, - _json = json + _json = json, ) } } } - return CustomerCreditLedgerCreateEntryBody(_json = json) + return Body(_json = json) } } - internal class Serializer : - BaseSerializer( - CustomerCreditLedgerCreateEntryBody::class - ) { + internal class Serializer : BaseSerializer(Body::class) { override fun serialize( - value: CustomerCreditLedgerCreateEntryBody, + value: Body, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.addIncrementCreditLedgerEntryRequestParams != null -> @@ -522,861 +546,391 @@ private constructor( value.addAmendmentCreditLedgerEntryRequestParams != null -> generator.writeObject(value.addAmendmentCreditLedgerEntryRequestParams) value._json != null -> generator.writeObject(value._json) - else -> - throw IllegalStateException("Invalid CustomerCreditLedgerCreateEntryBody") + else -> throw IllegalStateException("Invalid Body") } } } - } - fun toBuilder() = Builder().from(this) + @NoAutoDetect + class AddIncrementCreditLedgerEntryRequestParams + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") + @ExcludeMissing + private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("effective_date") + @ExcludeMissing + private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("expiry_date") + @ExcludeMissing + private val expiryDate: JsonField = JsonMissing.of(), + @JsonProperty("invoice_settings") + @ExcludeMissing + private val invoiceSettings: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("per_unit_cost_basis") + @ExcludeMissing + private val perUnitCostBasis: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - companion object { + /** + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. + */ + fun amount(): Double = amount.getRequired("amount") - @JvmStatic fun builder() = Builder() - } + fun entryType(): EntryType = entryType.getRequired("entry_type") - /** A builder for [CustomerCreditLedgerCreateEntryParams]. */ - @NoAutoDetect - class Builder internal constructor() { + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - private var customerId: String? = null - private var body: CustomerCreditLedgerCreateEntryBody? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) - @JvmSynthetic - internal fun from( - customerCreditLedgerCreateEntryParams: CustomerCreditLedgerCreateEntryParams - ) = apply { - customerId = customerCreditLedgerCreateEntryParams.customerId - body = customerCreditLedgerCreateEntryParams.body - additionalHeaders = customerCreditLedgerCreateEntryParams.additionalHeaders.toBuilder() - additionalQueryParams = - customerCreditLedgerCreateEntryParams.additionalQueryParams.toBuilder() - } + /** + * An ISO 8601 format date that denotes when this credit balance should become available + * for use. + */ + fun effectiveDate(): Optional = + Optional.ofNullable(effectiveDate.getNullable("effective_date")) - fun customerId(customerId: String) = apply { this.customerId = customerId } + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + fun expiryDate(): Optional = + Optional.ofNullable(expiryDate.getNullable("expiry_date")) - fun forAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams: AddIncrementCreditLedgerEntryRequestParams - ) = apply { - body = - CustomerCreditLedgerCreateEntryBody.ofAddIncrementCreditLedgerEntryRequestParams( - addIncrementCreditLedgerEntryRequestParams - ) - } + /** + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as + * the calculation of the invoice total is done on that basis. + */ + fun invoiceSettings(): Optional = + Optional.ofNullable(invoiceSettings.getNullable("invoice_settings")) - fun forAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams: AddDecrementCreditLedgerEntryRequestParams - ) = apply { - body = - CustomerCreditLedgerCreateEntryBody.ofAddDecrementCreditLedgerEntryRequestParams( - addDecrementCreditLedgerEntryRequestParams - ) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - fun forAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams - ) = apply { - body = - CustomerCreditLedgerCreateEntryBody - .ofAddExpirationChangeCreditLedgerEntryRequestParams( - addExpirationChangeCreditLedgerEntryRequestParams - ) - } + /** + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block + */ + fun perUnitCostBasis(): Optional = + Optional.ofNullable(perUnitCostBasis.getNullable("per_unit_cost_basis")) - fun forAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams - ) = apply { - body = - CustomerCreditLedgerCreateEntryBody.ofAddVoidCreditLedgerEntryRequestParams( - addVoidCreditLedgerEntryRequestParams - ) - } + /** + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - fun forAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams - ) = apply { - body = - CustomerCreditLedgerCreateEntryBody.ofAddAmendmentCreditLedgerEntryRequestParams( - addAmendmentCreditLedgerEntryRequestParams - ) - } + @JsonProperty("entry_type") + @ExcludeMissing + fun _entryType(): JsonField = entryType - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } + /** + * An ISO 8601 format date that denotes when this credit balance should become available + * for use. + */ + @JsonProperty("effective_date") + @ExcludeMissing + fun _effectiveDate(): JsonField = effectiveDate - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + @JsonProperty("expiry_date") + @ExcludeMissing + fun _expiryDate(): JsonField = expiryDate - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as + * the calculation of the invoice total is done on that basis. + */ + @JsonProperty("invoice_settings") + @ExcludeMissing + fun _invoiceSettings(): JsonField = invoiceSettings - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } + /** + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block + */ + @JsonProperty("per_unit_cost_basis") + @ExcludeMissing + fun _perUnitCostBasis(): JsonField = perUnitCostBasis - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + private var validated: Boolean = false - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + fun validate(): AddIncrementCreditLedgerEntryRequestParams = apply { + if (validated) { + return@apply + } - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + amount() + entryType() + currency() + description() + effectiveDate() + expiryDate() + invoiceSettings().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + perUnitCostBasis() + validated = true + } - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + fun toBuilder() = Builder().from(this) - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + companion object { - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + @JvmStatic fun builder() = Builder() + } - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + /** A builder for [AddIncrementCreditLedgerEntryRequestParams]. */ + class Builder internal constructor() { - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } + private var amount: JsonField? = null + private var entryType: JsonField? = null + private var currency: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var effectiveDate: JsonField = JsonMissing.of() + private var expiryDate: JsonField = JsonMissing.of() + private var invoiceSettings: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var perUnitCostBasis: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + @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() + } - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: Double) = amount(JsonField.of(amount)) - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } + fun entryType(entryType: JsonField) = apply { + this.entryType = entryType + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - fun build(): CustomerCreditLedgerCreateEntryParams = - CustomerCreditLedgerCreateEntryParams( - checkRequired("customerId", customerId), - body ?: CustomerCreditLedgerCreateEntryBody(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - @NoAutoDetect - class AddIncrementCreditLedgerEntryRequestParams - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("effective_date") - @ExcludeMissing - private val effectiveDate: JsonField = JsonMissing.of(), - @JsonProperty("expiry_date") - @ExcludeMissing - private val expiryDate: JsonField = JsonMissing.of(), - @JsonProperty("invoice_settings") - @ExcludeMissing - private val invoiceSettings: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonProperty("per_unit_cost_basis") - @ExcludeMissing - private val perUnitCostBasis: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(): Double = amount.getRequired("amount") - - fun entryType(): EntryType = entryType.getRequired("entry_type") - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * An ISO 8601 format date that denotes when this credit balance should become available for - * use. - */ - fun effectiveDate(): Optional = - Optional.ofNullable(effectiveDate.getNullable("effective_date")) - - /** An ISO 8601 format date that denotes when this credit balance should expire. */ - fun expiryDate(): Optional = - Optional.ofNullable(expiryDate.getNullable("expiry_date")) - - /** - * Passing `invoice_settings` automatically generates an invoice for the newly added - * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the - * calculation of the invoice total is done on that basis. - */ - fun invoiceSettings(): Optional = - Optional.ofNullable(invoiceSettings.getNullable("invoice_settings")) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** - * Can only be specified when entry_type=increment. How much, in the customer's currency, a - * customer paid for a single credit in this block - */ - fun perUnitCostBasis(): Optional = - Optional.ofNullable(perUnitCostBasis.getNullable("per_unit_cost_basis")) - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * An ISO 8601 format date that denotes when this credit balance should become available for - * use. - */ - @JsonProperty("effective_date") - @ExcludeMissing - fun _effectiveDate(): JsonField = effectiveDate - - /** An ISO 8601 format date that denotes when this credit balance should expire. */ - @JsonProperty("expiry_date") - @ExcludeMissing - fun _expiryDate(): JsonField = expiryDate - - /** - * Passing `invoice_settings` automatically generates an invoice for the newly added - * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the - * calculation of the invoice total is done on that basis. - */ - @JsonProperty("invoice_settings") - @ExcludeMissing - fun _invoiceSettings(): JsonField = invoiceSettings - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - /** - * Can only be specified when entry_type=increment. How much, in the customer's currency, a - * customer paid for a single credit in this block - */ - @JsonProperty("per_unit_cost_basis") - @ExcludeMissing - fun _perUnitCostBasis(): JsonField = perUnitCostBasis - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): AddIncrementCreditLedgerEntryRequestParams = apply { - if (validated) { - return@apply - } - - amount() - entryType() - currency() - description() - effectiveDate() - expiryDate() - invoiceSettings().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - perUnitCostBasis() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AddIncrementCreditLedgerEntryRequestParams]. */ - class Builder internal constructor() { - - private var amount: JsonField? = null - private var entryType: JsonField? = null - private var currency: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var effectiveDate: JsonField = JsonMissing.of() - private var expiryDate: JsonField = JsonMissing.of() - private var invoiceSettings: JsonField = JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - private var perUnitCostBasis: JsonField = JsonMissing.of() - 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() - } - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(amount: Double) = amount(JsonField.of(amount)) - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: Optional) = currency(currency.orElse(null)) - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: String?) = description(JsonField.ofNullable(description)) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: Optional) = description(description.orElse(null)) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: JsonField) = apply { - this.description = description - } - - /** - * An ISO 8601 format date that denotes when this credit balance should become available - * for use. - */ - fun effectiveDate(effectiveDate: OffsetDateTime?) = - effectiveDate(JsonField.ofNullable(effectiveDate)) - - /** - * An ISO 8601 format date that denotes when this credit balance should become available - * for use. - */ - fun effectiveDate(effectiveDate: Optional) = - effectiveDate(effectiveDate.orElse(null)) - - /** - * An ISO 8601 format date that denotes when this credit balance should become available - * for use. - */ - fun effectiveDate(effectiveDate: JsonField) = apply { - this.effectiveDate = effectiveDate - } - - /** An ISO 8601 format date that denotes when this credit balance should expire. */ - fun expiryDate(expiryDate: OffsetDateTime?) = - expiryDate(JsonField.ofNullable(expiryDate)) - - /** An ISO 8601 format date that denotes when this credit balance should expire. */ - fun expiryDate(expiryDate: Optional) = - expiryDate(expiryDate.orElse(null)) - - /** An ISO 8601 format date that denotes when this credit balance should expire. */ - fun expiryDate(expiryDate: JsonField) = apply { - this.expiryDate = expiryDate - } - - /** - * Passing `invoice_settings` automatically generates an invoice for the newly added - * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as - * the calculation of the invoice total is done on that basis. - */ - fun invoiceSettings(invoiceSettings: InvoiceSettings?) = - invoiceSettings(JsonField.ofNullable(invoiceSettings)) - - /** - * Passing `invoice_settings` automatically generates an invoice for the newly added - * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as - * the calculation of the invoice total is done on that basis. - */ - fun invoiceSettings(invoiceSettings: Optional) = - invoiceSettings(invoiceSettings.orElse(null)) - - /** - * Passing `invoice_settings` automatically generates an invoice for the newly added - * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as - * the calculation of the invoice total is done on that basis. - */ - fun invoiceSettings(invoiceSettings: JsonField) = apply { - this.invoiceSettings = invoiceSettings - } - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - - /** - * Can only be specified when entry_type=increment. How much, in the customer's - * currency, a customer paid for a single credit in this block - */ - fun perUnitCostBasis(perUnitCostBasis: String?) = - perUnitCostBasis(JsonField.ofNullable(perUnitCostBasis)) - - /** - * Can only be specified when entry_type=increment. How much, in the customer's - * currency, a customer paid for a single credit in this block - */ - fun perUnitCostBasis(perUnitCostBasis: Optional) = - perUnitCostBasis(perUnitCostBasis.orElse(null)) - - /** - * Can only be specified when entry_type=increment. How much, in the customer's - * currency, a customer paid for a single credit in this block - */ - fun perUnitCostBasis(perUnitCostBasis: JsonField) = apply { - this.perUnitCostBasis = perUnitCostBasis - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): AddIncrementCreditLedgerEntryRequestParams = - AddIncrementCreditLedgerEntryRequestParams( - checkRequired("amount", amount), - checkRequired("entryType", entryType), - currency, - description, - effectiveDate, - expiryDate, - invoiceSettings, - metadata, - perUnitCostBasis, - additionalProperties.toImmutable(), - ) - } - - 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") + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** An enum containing [EntryType]'s known values. */ - enum class Known { - INCREMENT, - } + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) - /** - * 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. + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. */ - _UNKNOWN, - } + fun description(description: Optional) = + description(description.orElse(null)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: JsonField) = apply { + this.description = description } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") - } + /** + * An ISO 8601 format date that denotes when this credit balance should become + * available for use. + */ + fun effectiveDate(effectiveDate: OffsetDateTime?) = + effectiveDate(JsonField.ofNullable(effectiveDate)) - fun asString(): String = _value().asStringOrThrow() + /** + * An ISO 8601 format date that denotes when this credit balance should become + * available for use. + */ + fun effectiveDate(effectiveDate: Optional) = + effectiveDate(effectiveDate.orElse(null)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * An ISO 8601 format date that denotes when this credit balance should become + * available for use. + */ + fun effectiveDate(effectiveDate: JsonField) = apply { + this.effectiveDate = effectiveDate } - 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 the - * calculation of the invoice total is done on that basis. - */ - @NoAutoDetect - class InvoiceSettings - @JsonCreator - private constructor( - @JsonProperty("auto_collection") - @ExcludeMissing - private val autoCollection: JsonField = JsonMissing.of(), - @JsonProperty("net_terms") - @ExcludeMissing - private val netTerms: JsonField = JsonMissing.of(), - @JsonProperty("memo") - @ExcludeMissing - private val memo: JsonField = JsonMissing.of(), - @JsonProperty("require_successful_payment") - @ExcludeMissing - private val requireSuccessfulPayment: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * Whether the credits purchase invoice should auto collect with the customer's saved - * payment method. - */ - fun autoCollection(): Boolean = autoCollection.getRequired("auto_collection") - - /** - * The net terms determines the difference between the invoice date and the issue date - * for the invoice. If you intend the invoice to be due on issue, set this to 0. - */ - fun netTerms(): Long = netTerms.getRequired("net_terms") + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + fun expiryDate(expiryDate: OffsetDateTime?) = + expiryDate(JsonField.ofNullable(expiryDate)) - /** An optional memo to display on the invoice. */ - fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo")) + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + fun expiryDate(expiryDate: Optional) = + expiryDate(expiryDate.orElse(null)) - /** - * If true, the new credit block will require that the corresponding invoice is paid - * before it can be drawn down from. - */ - fun requireSuccessfulPayment(): Optional = - Optional.ofNullable( - requireSuccessfulPayment.getNullable("require_successful_payment") - ) - - /** - * Whether the credits purchase invoice should auto collect with the customer's saved - * payment method. - */ - @JsonProperty("auto_collection") - @ExcludeMissing - fun _autoCollection(): JsonField = autoCollection - - /** - * The net terms determines the difference between the invoice date and the issue date - * for the invoice. If you intend the invoice to be due on issue, set this to 0. - */ - @JsonProperty("net_terms") @ExcludeMissing fun _netTerms(): JsonField = netTerms - - /** An optional memo to display on the invoice. */ - @JsonProperty("memo") @ExcludeMissing fun _memo(): JsonField = memo - - /** - * If true, the new credit block will require that the corresponding invoice is paid - * before it can be drawn down from. - */ - @JsonProperty("require_successful_payment") - @ExcludeMissing - fun _requireSuccessfulPayment(): JsonField = requireSuccessfulPayment - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InvoiceSettings = apply { - if (validated) { - return@apply + /** An ISO 8601 format date that denotes when this credit balance should expire. */ + fun expiryDate(expiryDate: JsonField) = apply { + this.expiryDate = expiryDate } - autoCollection() - netTerms() - memo() - requireSuccessfulPayment() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [InvoiceSettings]. */ - class Builder internal constructor() { - - private var autoCollection: JsonField? = null - private var netTerms: JsonField? = null - private var memo: JsonField = JsonMissing.of() - private var requireSuccessfulPayment: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(invoiceSettings: InvoiceSettings) = apply { - autoCollection = invoiceSettings.autoCollection - netTerms = invoiceSettings.netTerms - memo = invoiceSettings.memo - requireSuccessfulPayment = invoiceSettings.requireSuccessfulPayment - additionalProperties = invoiceSettings.additionalProperties.toMutableMap() - } + /** + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, + * as the calculation of the invoice total is done on that basis. + */ + fun invoiceSettings(invoiceSettings: InvoiceSettings?) = + invoiceSettings(JsonField.ofNullable(invoiceSettings)) /** - * Whether the credits purchase invoice should auto collect with the customer's - * saved payment method. + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, + * as the calculation of the invoice total is done on that basis. */ - fun autoCollection(autoCollection: Boolean) = - autoCollection(JsonField.of(autoCollection)) + fun invoiceSettings(invoiceSettings: Optional) = + invoiceSettings(invoiceSettings.orElse(null)) /** - * Whether the credits purchase invoice should auto collect with the customer's - * saved payment method. + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, + * as the calculation of the invoice total is done on that basis. */ - fun autoCollection(autoCollection: JsonField) = apply { - this.autoCollection = autoCollection + fun invoiceSettings(invoiceSettings: JsonField) = apply { + this.invoiceSettings = invoiceSettings } /** - * The net terms determines the difference between the invoice date and the issue - * date for the invoice. If you intend the invoice to be due on issue, set this - * to 0. + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun netTerms(netTerms: Long) = netTerms(JsonField.of(netTerms)) + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) /** - * The net terms determines the difference between the invoice date and the issue - * date for the invoice. If you intend the invoice to be due on issue, set this - * to 0. + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** An optional memo to display on the invoice. */ - fun memo(memo: String?) = memo(JsonField.ofNullable(memo)) - - /** An optional memo to display on the invoice. */ - fun memo(memo: Optional) = memo(memo.orElse(null)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - /** An optional memo to display on the invoice. */ - fun memo(memo: JsonField) = apply { this.memo = memo } + /** + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block + */ + fun perUnitCostBasis(perUnitCostBasis: String?) = + perUnitCostBasis(JsonField.ofNullable(perUnitCostBasis)) /** - * If true, the new credit block will require that the corresponding invoice is paid - * before it can be drawn down from. + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block */ - fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) = - requireSuccessfulPayment(JsonField.of(requireSuccessfulPayment)) + fun perUnitCostBasis(perUnitCostBasis: Optional) = + perUnitCostBasis(perUnitCostBasis.orElse(null)) /** - * If true, the new credit block will require that the corresponding invoice is paid - * before it can be drawn down from. + * Can only be specified when entry_type=increment. How much, in the customer's + * currency, a customer paid for a single credit in this block */ - fun requireSuccessfulPayment(requireSuccessfulPayment: JsonField) = apply { - this.requireSuccessfulPayment = requireSuccessfulPayment + fun perUnitCostBasis(perUnitCostBasis: JsonField) = apply { + this.perUnitCostBasis = perUnitCostBasis } fun additionalProperties(additionalProperties: Map) = apply { @@ -1401,327 +955,330 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InvoiceSettings = - InvoiceSettings( - checkRequired("autoCollection", autoCollection), - checkRequired("netTerms", netTerms), - memo, - requireSuccessfulPayment, + fun build(): AddIncrementCreditLedgerEntryRequestParams = + AddIncrementCreditLedgerEntryRequestParams( + checkRequired("amount", amount), + checkRequired("entryType", entryType), + currency, + description, + effectiveDate, + expiryDate, + invoiceSettings, + metadata, + perUnitCostBasis, additionalProperties.toImmutable(), ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is InvoiceSettings && autoCollection == other.autoCollection && netTerms == other.netTerms && memo == other.memo && requireSuccessfulPayment == other.requireSuccessfulPayment && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(autoCollection, netTerms, memo, requireSuccessfulPayment, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "InvoiceSettings{autoCollection=$autoCollection, netTerms=$netTerms, memo=$memo, requireSuccessfulPayment=$requireSuccessfulPayment, additionalProperties=$additionalProperties}" - } + 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`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + companion object { - private var validated: Boolean = false + @JvmField val INCREMENT = of("increment") - fun validate(): Metadata = apply { - if (validated) { - return@apply + @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) } - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @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() + /** An enum containing [EntryType]'s known values. */ + enum class Known { + INCREMENT } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + /** + * 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, } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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 + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(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) { + INCREMENT -> Known.INCREMENT + else -> throw OrbInvalidDataException("Unknown EntryType: $value") } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + fun asString(): String = _value().asStringOrThrow() - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Passing `invoice_settings` automatically generates an invoice for the newly added + * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as + * the calculation of the invoice total is done on that basis. + */ + @NoAutoDetect + class InvoiceSettings + @JsonCreator + private constructor( + @JsonProperty("auto_collection") + @ExcludeMissing + private val autoCollection: JsonField = JsonMissing.of(), + @JsonProperty("net_terms") + @ExcludeMissing + private val netTerms: JsonField = JsonMissing.of(), + @JsonProperty("memo") + @ExcludeMissing + private val memo: JsonField = JsonMissing.of(), + @JsonProperty("require_successful_payment") + @ExcludeMissing + private val requireSuccessfulPayment: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Whether the credits purchase invoice should auto collect with the customer's + * saved payment method. + */ + fun autoCollection(): Boolean = autoCollection.getRequired("auto_collection") - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * The net terms determines the difference between the invoice date and the issue + * date for the invoice. If you intend the invoice to be due on issue, set this + * to 0. + */ + fun netTerms(): Long = netTerms.getRequired("net_terms") - override fun hashCode(): Int = hashCode + /** An optional memo to display on the invoice. */ + fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo")) - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + /** + * If true, the new credit block will require that the corresponding invoice is paid + * before it can be drawn down from. + */ + fun requireSuccessfulPayment(): Optional = + Optional.ofNullable( + requireSuccessfulPayment.getNullable("require_successful_payment") + ) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Whether the credits purchase invoice should auto collect with the customer's + * saved payment method. + */ + @JsonProperty("auto_collection") + @ExcludeMissing + fun _autoCollection(): JsonField = autoCollection - 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 */ - } + /** + * The net terms determines the difference between the invoice date and the issue + * date for the invoice. If you intend the invoice to be due on issue, set this + * to 0. + */ + @JsonProperty("net_terms") + @ExcludeMissing + fun _netTerms(): JsonField = netTerms - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, entryType, currency, description, effectiveDate, expiryDate, invoiceSettings, metadata, perUnitCostBasis, additionalProperties) } - /* spotless:on */ + /** An optional memo to display on the invoice. */ + @JsonProperty("memo") @ExcludeMissing fun _memo(): JsonField = memo - override fun hashCode(): Int = hashCode + /** + * If true, the new credit block will require that the corresponding invoice is paid + * before it can be drawn down from. + */ + @JsonProperty("require_successful_payment") + @ExcludeMissing + fun _requireSuccessfulPayment(): JsonField = requireSuccessfulPayment - override fun toString() = - "AddIncrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, effectiveDate=$effectiveDate, expiryDate=$expiryDate, invoiceSettings=$invoiceSettings, metadata=$metadata, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}" - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @NoAutoDetect - class AddDecrementCreditLedgerEntryRequestParams - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var validated: Boolean = false - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(): Double = amount.getRequired("amount") - - fun entryType(): EntryType = entryType.getRequired("entry_type") - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun validate(): InvoiceSettings = apply { + if (validated) { + return@apply + } - private var validated: Boolean = false + autoCollection() + netTerms() + memo() + requireSuccessfulPayment() + validated = true + } - fun validate(): AddDecrementCreditLedgerEntryRequestParams = apply { - if (validated) { - return@apply - } + fun toBuilder() = Builder().from(this) - amount() - entryType() - currency() - description() - metadata().ifPresent { it.validate() } - validated = true - } + companion object { - fun toBuilder() = Builder().from(this) + @JvmStatic fun builder() = Builder() + } - companion object { + /** A builder for [InvoiceSettings]. */ + class Builder internal constructor() { - @JvmStatic fun builder() = Builder() - } + private var autoCollection: JsonField? = null + private var netTerms: JsonField? = null + private var memo: JsonField = JsonMissing.of() + private var requireSuccessfulPayment: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** A builder for [AddDecrementCreditLedgerEntryRequestParams]. */ - class Builder internal constructor() { + @JvmSynthetic + internal fun from(invoiceSettings: InvoiceSettings) = apply { + autoCollection = invoiceSettings.autoCollection + netTerms = invoiceSettings.netTerms + memo = invoiceSettings.memo + requireSuccessfulPayment = invoiceSettings.requireSuccessfulPayment + additionalProperties = invoiceSettings.additionalProperties.toMutableMap() + } - private var amount: JsonField? = null - private var entryType: JsonField? = null - private var currency: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Whether the credits purchase invoice should auto collect with the customer's + * saved payment method. + */ + fun autoCollection(autoCollection: Boolean) = + autoCollection(JsonField.of(autoCollection)) + + /** + * Whether the credits purchase invoice should auto collect with the customer's + * saved payment method. + */ + fun autoCollection(autoCollection: JsonField) = apply { + this.autoCollection = autoCollection + } - @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() - } + /** + * The net terms determines the difference between the invoice date and the + * issue date for the invoice. If you intend the invoice to be due on issue, set + * this to 0. + */ + fun netTerms(netTerms: Long) = netTerms(JsonField.of(netTerms)) + + /** + * The net terms determines the difference between the invoice date and the + * issue date for the invoice. If you intend the invoice to be due on issue, set + * this to 0. + */ + fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } + + /** An optional memo to display on the invoice. */ + fun memo(memo: String?) = memo(JsonField.ofNullable(memo)) + + /** An optional memo to display on the invoice. */ + fun memo(memo: Optional) = memo(memo.orElse(null)) + + /** An optional memo to display on the invoice. */ + fun memo(memo: JsonField) = apply { this.memo = memo } + + /** + * If true, the new credit block will require that the corresponding invoice is + * paid before it can be drawn down from. + */ + fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) = + requireSuccessfulPayment(JsonField.of(requireSuccessfulPayment)) + + /** + * If true, the new credit block will require that the corresponding invoice is + * paid before it can be drawn down from. + */ + fun requireSuccessfulPayment(requireSuccessfulPayment: JsonField) = + apply { + this.requireSuccessfulPayment = requireSuccessfulPayment + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + fun build(): InvoiceSettings = + InvoiceSettings( + checkRequired("autoCollection", autoCollection), + checkRequired("netTerms", netTerms), + memo, + requireSuccessfulPayment, + additionalProperties.toImmutable(), + ) + } - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } + return /* spotless:off */ other is InvoiceSettings && autoCollection == other.autoCollection && netTerms == other.netTerms && memo == other.memo && requireSuccessfulPayment == other.requireSuccessfulPayment && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: String?) = description(JsonField.ofNullable(description)) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(autoCollection, netTerms, memo, requireSuccessfulPayment, additionalProperties) } + /* spotless:on */ - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: Optional) = description(description.orElse(null)) + override fun hashCode(): Int = hashCode - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: JsonField) = apply { - this.description = description + override fun toString() = + "InvoiceSettings{autoCollection=$autoCollection, netTerms=$netTerms, memo=$memo, requireSuccessfulPayment=$requireSuccessfulPayment, additionalProperties=$additionalProperties}" } /** @@ -1729,165 +1286,208 @@ private constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + validated = true + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + @JvmStatic fun builder() = Builder() + } - fun build(): AddDecrementCreditLedgerEntryRequestParams = - AddDecrementCreditLedgerEntryRequestParams( - checkRequired("amount", amount), - checkRequired("entryType", entryType), - currency, - description, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - companion object { + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JvmField val DECREMENT = of("decrement") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** An enum containing [EntryType]'s known values. */ - enum class Known { - DECREMENT, - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * 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, - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + return /* spotless:off */ other is AddIncrementCreditLedgerEntryRequestParams && amount == other.amount && entryType == other.entryType && currency == other.currency && description == other.description && effectiveDate == other.effectiveDate && expiryDate == other.expiryDate && invoiceSettings == other.invoiceSettings && metadata == other.metadata && perUnitCostBasis == other.perUnitCostBasis && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, entryType, currency, description, effectiveDate, expiryDate, invoiceSettings, metadata, perUnitCostBasis, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - override fun toString() = value.toString() + override fun toString() = + "AddIncrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, effectiveDate=$effectiveDate, expiryDate=$expiryDate, invoiceSettings=$invoiceSettings, metadata=$metadata, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}" } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ @NoAutoDetect - class Metadata + class AddDecrementCreditLedgerEntryRequestParams @JsonCreator private constructor( + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") + @ExcludeMissing + private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { + /** + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. + */ + fun amount(): Double = amount.getRequired("amount") + + fun entryType(): EntryType = entryType.getRequired("entry_type") + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + @JsonProperty("entry_type") + @ExcludeMissing + fun _entryType(): JsonField = entryType + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): Metadata = apply { + fun validate(): AddDecrementCreditLedgerEntryRequestParams = apply { if (validated) { return@apply } + amount() + entryType() + currency() + description() + metadata().ifPresent { it.validate() } validated = true } @@ -1898,16 +1498,113 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Metadata]. */ + /** A builder for [AddDecrementCreditLedgerEntryRequestParams]. */ class Builder internal constructor() { + private var amount: JsonField? = null + private var entryType: JsonField? = null + private var currency: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() + 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() + } + + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: Double) = amount(JsonField.of(amount)) + + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + + fun entryType(entryType: JsonField) = apply { + this.entryType = entryType + } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) + + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: Optional) = + description(description.orElse(null)) + + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: JsonField) = apply { + this.description = description } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1930,559 +1627,754 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + fun build(): AddDecrementCreditLedgerEntryRequestParams = + AddDecrementCreditLedgerEntryRequestParams( + checkRequired("amount", amount), + checkRequired("entryType", entryType), + currency, + description, + metadata, + additionalProperties.toImmutable(), + ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + 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)) } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** An enum containing [EntryType]'s known values. */ + enum class Known { + DECREMENT + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * 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, + } - override fun hashCode(): Int = hashCode + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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 + } - override fun toString() = "Metadata{additionalProperties=$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) { + DECREMENT -> Known.DECREMENT + else -> throw OrbInvalidDataException("Unknown EntryType: $value") + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun asString(): String = _value().asStringOrThrow() + + 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() } - 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 */ - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, entryType, currency, description, metadata, additionalProperties) } - /* spotless:on */ + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun hashCode(): Int = hashCode + private var validated: Boolean = false - override fun toString() = - "AddDecrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - @NoAutoDetect - class AddExpirationChangeCreditLedgerEntryRequestParams - @JsonCreator - private constructor( - @JsonProperty("entry_type") - @ExcludeMissing - private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("expiry_date") - @ExcludeMissing - private val expiryDate: JsonField = JsonMissing.of(), - @JsonProperty("target_expiry_date") - @ExcludeMissing - private val targetExpiryDate: JsonField = JsonMissing.of(), - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("block_id") - @ExcludeMissing - private val blockId: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + validated = true + } - fun entryType(): EntryType = entryType.getRequired("entry_type") - - /** An ISO 8601 format date that identifies the origination credit block to expire */ - fun expiryDate(): Optional = - Optional.ofNullable(expiryDate.getNullable("expiry_date")) - - /** - * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting when - * credits transferred (as part of a partial block expiration) should expire. - */ - fun targetExpiryDate(): LocalDate = targetExpiryDate.getRequired("target_expiry_date") - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) - - /** - * The ID of the block affected by an expiration_change, used to differentiate between - * multiple blocks with the same `expiry_date`. - */ - fun blockId(): Optional = Optional.ofNullable(blockId.getNullable("block_id")) - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - - /** An ISO 8601 format date that identifies the origination credit block to expire */ - @JsonProperty("expiry_date") - @ExcludeMissing - fun _expiryDate(): JsonField = expiryDate - - /** - * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting when - * credits transferred (as part of a partial block expiration) should expire. - */ - @JsonProperty("target_expiry_date") - @ExcludeMissing - fun _targetExpiryDate(): JsonField = targetExpiryDate - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * The ID of the block affected by an expiration_change, used to differentiate between - * multiple blocks with the same `expiry_date`. - */ - @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): AddExpirationChangeCreditLedgerEntryRequestParams = apply { - if (validated) { - return@apply - } + @JvmStatic fun builder() = Builder() + } - entryType() - expiryDate() - targetExpiryDate() - amount() - blockId() - currency() - description() - metadata().ifPresent { it.validate() } - validated = true - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - fun toBuilder() = Builder().from(this) + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - @JvmStatic fun builder() = Builder() - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** A builder for [AddExpirationChangeCreditLedgerEntryRequestParams]. */ - class Builder internal constructor() { - - private var entryType: JsonField? = null - private var expiryDate: JsonField? = null - private var targetExpiryDate: JsonField? = null - private var amount: JsonField = JsonMissing.of() - private var blockId: JsonField = JsonMissing.of() - private var currency: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + 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 */ } - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, entryType, currency, description, metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + override fun toString() = + "AddDecrementCreditLedgerEntryRequestParams{amount=$amount, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" + } - /** An ISO 8601 format date that identifies the origination credit block to expire */ - fun expiryDate(expiryDate: OffsetDateTime?) = - expiryDate(JsonField.ofNullable(expiryDate)) + @NoAutoDetect + class AddExpirationChangeCreditLedgerEntryRequestParams + @JsonCreator + private constructor( + @JsonProperty("entry_type") + @ExcludeMissing + private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("expiry_date") + @ExcludeMissing + private val expiryDate: JsonField = JsonMissing.of(), + @JsonProperty("target_expiry_date") + @ExcludeMissing + private val targetExpiryDate: JsonField = JsonMissing.of(), + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("block_id") + @ExcludeMissing + private val blockId: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** An ISO 8601 format date that identifies the origination credit block to expire */ - fun expiryDate(expiryDate: Optional) = - expiryDate(expiryDate.orElse(null)) + fun entryType(): EntryType = entryType.getRequired("entry_type") /** An ISO 8601 format date that identifies the origination credit block to expire */ - fun expiryDate(expiryDate: JsonField) = apply { - this.expiryDate = expiryDate - } - - /** - * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting - * when credits transferred (as part of a partial block expiration) should expire. - */ - fun targetExpiryDate(targetExpiryDate: LocalDate) = - targetExpiryDate(JsonField.of(targetExpiryDate)) + fun expiryDate(): Optional = + Optional.ofNullable(expiryDate.getNullable("expiry_date")) /** * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting * when credits transferred (as part of a partial block expiration) should expire. */ - fun targetExpiryDate(targetExpiryDate: JsonField) = apply { - this.targetExpiryDate = targetExpiryDate - } + fun targetExpiryDate(): LocalDate = targetExpiryDate.getRequired("target_expiry_date") /** * The number of credits to effect. Note that this is required for increment, decrement, * void, or undo operations. */ - fun amount(amount: Double?) = amount(JsonField.ofNullable(amount)) + fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * The ID of the block affected by an expiration_change, used to differentiate between + * multiple blocks with the same `expiry_date`. */ - fun amount(amount: Double) = amount(amount as Double?) + fun blockId(): Optional = Optional.ofNullable(blockId.getNullable("block_id")) /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun amount(amount: Optional) = amount(amount.orElse(null) as Double?) + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. */ - fun amount(amount: JsonField) = apply { this.amount = amount } + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** - * The ID of the block affected by an expiration_change, used to differentiate between - * multiple blocks with the same `expiry_date`. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun blockId(blockId: String?) = blockId(JsonField.ofNullable(blockId)) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** - * The ID of the block affected by an expiration_change, used to differentiate between - * multiple blocks with the same `expiry_date`. - */ - fun blockId(blockId: Optional) = blockId(blockId.orElse(null)) + @JsonProperty("entry_type") + @ExcludeMissing + fun _entryType(): JsonField = entryType + + /** An ISO 8601 format date that identifies the origination credit block to expire */ + @JsonProperty("expiry_date") + @ExcludeMissing + fun _expiryDate(): JsonField = expiryDate /** - * The ID of the block affected by an expiration_change, used to differentiate between - * multiple blocks with the same `expiry_date`. + * A future date (specified in YYYY-MM-DD format) used for expiration change, denoting + * when credits transferred (as part of a partial block expiration) should expire. */ - fun blockId(blockId: JsonField) = apply { this.blockId = blockId } + @JsonProperty("target_expiry_date") + @ExcludeMissing + fun _targetExpiryDate(): JsonField = targetExpiryDate /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. + * The ID of the block affected by an expiration_change, used to differentiate between + * multiple blocks with the same `expiry_date`. */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId /** * The currency or custom pricing unit to use for this ledger entry. If this is a * real-world currency, it must match the customer's invoicing currency. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: String?) = description(JsonField.ofNullable(description)) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: Optional) = description(description.orElse(null)) + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency /** * Optional metadata that can be specified when adding ledger results via the API. For * example, this can be used to note an increment refers to trial credits, or for noting * corrections as a result of an incident, etc. */ - fun description(description: JsonField) = apply { - this.description = description - } + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): AddExpirationChangeCreditLedgerEntryRequestParams = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + entryType() + expiryDate() + targetExpiryDate() + amount() + blockId() + currency() + description() + metadata().ifPresent { it.validate() } + validated = true } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): AddExpirationChangeCreditLedgerEntryRequestParams = - AddExpirationChangeCreditLedgerEntryRequestParams( - checkRequired("entryType", entryType), - checkRequired("expiryDate", expiryDate), - checkRequired("targetExpiryDate", targetExpiryDate), - amount, - blockId, - currency, - description, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [AddExpirationChangeCreditLedgerEntryRequestParams]. */ + class Builder internal constructor() { - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var entryType: JsonField? = null + private var expiryDate: JsonField? = null + private var targetExpiryDate: JsonField? = null + private var amount: JsonField = JsonMissing.of() + private var blockId: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @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() + } + + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + + fun entryType(entryType: JsonField) = apply { + this.entryType = entryType + } - companion object { + /** + * An ISO 8601 format date that identifies the origination credit block to expire + */ + fun expiryDate(expiryDate: OffsetDateTime?) = + expiryDate(JsonField.ofNullable(expiryDate)) - @JvmField val EXPIRATION_CHANGE = of("expiration_change") + /** + * An ISO 8601 format date that identifies the origination credit block to expire + */ + fun expiryDate(expiryDate: Optional) = + expiryDate(expiryDate.orElse(null)) - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } + /** + * An ISO 8601 format date that identifies the origination credit block to expire + */ + fun expiryDate(expiryDate: JsonField) = apply { + this.expiryDate = expiryDate + } - /** An enum containing [EntryType]'s known values. */ - enum class Known { - EXPIRATION_CHANGE, - } + /** + * A future date (specified in YYYY-MM-DD format) used for expiration change, + * denoting when credits transferred (as part of a partial block expiration) should + * expire. + */ + fun targetExpiryDate(targetExpiryDate: LocalDate) = + targetExpiryDate(JsonField.of(targetExpiryDate)) + + /** + * A future date (specified in YYYY-MM-DD format) used for expiration change, + * denoting when credits transferred (as part of a partial block expiration) should + * expire. + */ + fun targetExpiryDate(targetExpiryDate: JsonField) = apply { + this.targetExpiryDate = targetExpiryDate + } + + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: Double?) = amount(JsonField.ofNullable(amount)) + + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: Double) = amount(amount as Double?) + + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun amount(amount: Optional) = amount(amount.orElse(null) as Double?) + + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** + * The ID of the block affected by an expiration_change, used to differentiate + * between multiple blocks with the same `expiry_date`. + */ + fun blockId(blockId: String?) = blockId(JsonField.ofNullable(blockId)) + + /** + * The ID of the block affected by an expiration_change, used to differentiate + * between multiple blocks with the same `expiry_date`. + */ + fun blockId(blockId: Optional) = blockId(blockId.orElse(null)) + + /** + * The ID of the block affected by an expiration_change, used to differentiate + * between multiple blocks with the same `expiry_date`. + */ + fun blockId(blockId: JsonField) = apply { this.blockId = blockId } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) + + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: Optional) = + description(description.orElse(null)) + + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** - * 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. + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - _UNKNOWN, + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): AddExpirationChangeCreditLedgerEntryRequestParams = + AddExpirationChangeCreditLedgerEntryRequestParams( + checkRequired("entryType", entryType), + checkRequired("expiryDate", expiryDate), + checkRequired("targetExpiryDate", targetExpiryDate), + amount, + blockId, + currency, + description, + metadata, + additionalProperties.toImmutable(), + ) } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 + 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)) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") + /** An enum containing [EntryType]'s known values. */ + enum class Known { + EXPIRATION_CHANGE } - fun asString(): String = _value().asStringOrThrow() + /** + * 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, + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ } - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - override fun hashCode() = value.hashCode() + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun toString() = value.toString() - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var validated: Boolean = false - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - private var validated: Boolean = false + validated = true + } - fun validate(): Metadata = apply { - if (validated) { - return@apply + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() } - validated = true - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - fun toBuilder() = Builder().from(this) + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - @JvmStatic fun builder() = Builder() - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - private var additionalProperties: MutableMap = mutableMapOf() + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2490,479 +2382,576 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddExpirationChangeCreditLedgerEntryRequestParams && entryType == other.entryType && expiryDate == other.expiryDate && targetExpiryDate == other.targetExpiryDate && amount == other.amount && blockId == other.blockId && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(entryType, expiryDate, targetExpiryDate, amount, blockId, currency, description, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - 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 */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(entryType, expiryDate, targetExpiryDate, amount, blockId, currency, description, metadata, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "AddExpirationChangeCreditLedgerEntryRequestParams{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" - } - - @NoAutoDetect - class AddVoidCreditLedgerEntryRequestParams - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("block_id") - @ExcludeMissing - private val blockId: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonProperty("void_reason") - @ExcludeMissing - private val voidReason: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(): Double = amount.getRequired("amount") - - /** The ID of the block to void. */ - fun blockId(): String = blockId.getRequired("block_id") - - fun entryType(): EntryType = entryType.getRequired("entry_type") - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** Can only be specified when `entry_type=void`. The reason for the void. */ - fun voidReason(): Optional = - Optional.ofNullable(voidReason.getNullable("void_reason")) - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** The ID of the block to void. */ - @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId - - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - /** Can only be specified when `entry_type=void`. The reason for the void. */ - @JsonProperty("void_reason") - @ExcludeMissing - fun _voidReason(): JsonField = voidReason - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): AddVoidCreditLedgerEntryRequestParams = apply { - if (validated) { - return@apply - } - - amount() - blockId() - entryType() - currency() - description() - metadata().ifPresent { it.validate() } - voidReason() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() + override fun toString() = + "AddExpirationChangeCreditLedgerEntryRequestParams{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } - /** A builder for [AddVoidCreditLedgerEntryRequestParams]. */ - class Builder internal constructor() { - - private var amount: JsonField? = null - private var blockId: JsonField? = null - private var entryType: JsonField? = null - private var currency: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - private var voidReason: JsonField = JsonMissing.of() - 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() - } - - /** - * The number of credits to effect. Note that this is required for increment, decrement, - * void, or undo operations. - */ - fun amount(amount: Double) = amount(JsonField.of(amount)) + @NoAutoDetect + class AddVoidCreditLedgerEntryRequestParams + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("block_id") + @ExcludeMissing + private val blockId: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") + @ExcludeMissing + private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonProperty("void_reason") + @ExcludeMissing + private val voidReason: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** * The number of credits to effect. Note that this is required for increment, decrement, * void, or undo operations. */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** The ID of the block to void. */ - fun blockId(blockId: String) = blockId(JsonField.of(blockId)) + fun amount(): Double = amount.getRequired("amount") /** The ID of the block to void. */ - fun blockId(blockId: JsonField) = apply { this.blockId = blockId } - - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + fun blockId(): String = blockId.getRequired("block_id") - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + fun entryType(): EntryType = entryType.getRequired("entry_type") /** * The currency or custom pricing unit to use for this ledger entry. If this is a * real-world currency, it must match the customer's invoicing currency. */ - fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** Can only be specified when `entry_type=void`. The reason for the void. */ + fun voidReason(): Optional = + Optional.ofNullable(voidReason.getNullable("void_reason")) /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. + * The number of credits to effect. Note that this is required for increment, decrement, + * void, or undo operations. */ - fun description(description: String?) = description(JsonField.ofNullable(description)) + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** The ID of the block to void. */ + @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId + + @JsonProperty("entry_type") + @ExcludeMissing + fun _entryType(): JsonField = entryType /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun description(description: Optional) = description(description.orElse(null)) + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency /** * Optional metadata that can be specified when adding ledger results via the API. For * example, this can be used to note an increment refers to trial credits, or for noting * corrections as a result of an incident, etc. */ - fun description(description: JsonField) = apply { - this.description = description - } + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + /** Can only be specified when `entry_type=void`. The reason for the void. */ + @JsonProperty("void_reason") + @ExcludeMissing + fun _voidReason(): JsonField = voidReason - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** Can only be specified when `entry_type=void`. The reason for the void. */ - fun voidReason(voidReason: VoidReason?) = voidReason(JsonField.ofNullable(voidReason)) + private var validated: Boolean = false - /** Can only be specified when `entry_type=void`. The reason for the void. */ - fun voidReason(voidReason: Optional) = voidReason(voidReason.orElse(null)) + fun validate(): AddVoidCreditLedgerEntryRequestParams = apply { + if (validated) { + return@apply + } - /** Can only be specified when `entry_type=void`. The reason for the void. */ - fun voidReason(voidReason: JsonField) = apply { - this.voidReason = voidReason + amount() + blockId() + entryType() + currency() + description() + metadata().ifPresent { it.validate() } + voidReason() + validated = true } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + companion object { - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) + @JvmStatic fun builder() = Builder() } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + /** A builder for [AddVoidCreditLedgerEntryRequestParams]. */ + class Builder internal constructor() { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + private var amount: JsonField? = null + private var blockId: JsonField? = null + private var entryType: JsonField? = null + private var currency: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var voidReason: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - fun build(): AddVoidCreditLedgerEntryRequestParams = - AddVoidCreditLedgerEntryRequestParams( - checkRequired("amount", amount), - checkRequired("blockId", blockId), - checkRequired("entryType", entryType), - currency, - description, - metadata, - voidReason, - additionalProperties.toImmutable(), - ) - } + @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() + } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: Double) = amount(JsonField.of(amount)) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * The number of credits to effect. Note that this is required for increment, + * decrement, void, or undo operations. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } - companion object { + /** The ID of the block to void. */ + fun blockId(blockId: String) = blockId(JsonField.of(blockId)) - @JvmField val VOID = of("void") + /** The ID of the block to void. */ + fun blockId(blockId: JsonField) = apply { this.blockId = blockId } - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - /** An enum containing [EntryType]'s known values. */ - enum class Known { - VOID, - } + fun entryType(entryType: JsonField) = apply { + this.entryType = entryType + } + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) + + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: Optional) = + description(description.orElse(null)) + + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * 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. + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - _UNKNOWN, + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** Can only be specified when `entry_type=void`. The reason for the void. */ + fun voidReason(voidReason: VoidReason?) = + voidReason(JsonField.ofNullable(voidReason)) + + /** Can only be specified when `entry_type=void`. The reason for the void. */ + fun voidReason(voidReason: Optional) = + voidReason(voidReason.orElse(null)) + + /** Can only be specified when `entry_type=void`. The reason for the void. */ + fun voidReason(voidReason: JsonField) = apply { + this.voidReason = voidReason + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): AddVoidCreditLedgerEntryRequestParams = + AddVoidCreditLedgerEntryRequestParams( + checkRequired("amount", amount), + checkRequired("blockId", blockId), + checkRequired("entryType", entryType), + currency, + description, + metadata, + voidReason, + additionalProperties.toImmutable(), + ) } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 + 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") + } + + fun asString(): String = _value().asStringOrThrow() + + 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() + } + /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun known(): Known = - when (this) { - VOID -> Known.VOID - else -> throw OrbInvalidDataException("Unknown EntryType: $value") + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + validated = true } - fun asString(): String = _value().asStringOrThrow() + fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + companion object { + + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - override fun hashCode() = value.hashCode() + private var additionalProperties: MutableMap = mutableMapOf() - override fun toString() = value.toString() - } + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + 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(): Metadata = apply { - if (validated) { - return@apply + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - @JvmStatic fun builder() = Builder() + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** Can only be specified when `entry_type=void`. The reason for the void. */ + class VoidReason + @JsonCreator + private constructor(private val value: JsonField) : Enum { - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() + companion object { + + @JvmField val REFUND = of("refund") + + @JvmStatic fun of(value: String) = VoidReason(JsonField.of(value)) } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + /** An enum containing [VoidReason]'s known values. */ + enum class Known { + REFUND } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * An enum containing [VoidReason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [VoidReason] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + REFUND, + /** + * An enum member indicating that [VoidReason] was instantiated with an unknown + * value. + */ + _UNKNOWN, } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + REFUND -> Value.REFUND + else -> Value._UNKNOWN } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + REFUND -> Known.REFUND + else -> throw OrbInvalidDataException("Unknown VoidReason: $value") + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is VoidReason && value == other.value /* spotless:on */ } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { @@ -2970,333 +2959,375 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AddVoidCreditLedgerEntryRequestParams && amount == other.amount && blockId == other.blockId && entryType == other.entryType && currency == other.currency && description == other.description && metadata == other.metadata && voidReason == other.voidReason && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, blockId, entryType, currency, description, metadata, voidReason, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + override fun toString() = + "AddVoidCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, voidReason=$voidReason, additionalProperties=$additionalProperties}" } - /** Can only be specified when `entry_type=void`. The reason for the void. */ - class VoidReason + @NoAutoDetect + class AddAmendmentCreditLedgerEntryRequestParams @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("block_id") + @ExcludeMissing + private val blockId: JsonField = JsonMissing.of(), + @JsonProperty("entry_type") + @ExcludeMissing + private val entryType: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. + * The number of credits to effect. Note that this is required for increment, decrement + * or void operations. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun amount(): Double = amount.getRequired("amount") - companion object { + /** The ID of the block to reverse a decrement from. */ + fun blockId(): String = blockId.getRequired("block_id") - @JvmField val REFUND = of("refund") + fun entryType(): EntryType = entryType.getRequired("entry_type") - @JvmStatic fun of(value: String) = VoidReason(JsonField.of(value)) - } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - /** An enum containing [VoidReason]'s known values. */ - enum class Known { - REFUND, - } + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) /** - * An enum containing [VoidReason]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [VoidReason] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - enum class Value { - REFUND, - /** - * An enum member indicating that [VoidReason] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * The number of credits to effect. Note that this is required for increment, decrement + * or void operations. */ - fun value(): Value = - when (this) { - REFUND -> Value.REFUND - else -> Value._UNKNOWN - } + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** The ID of the block to reverse a decrement from. */ + @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId + + @JsonProperty("entry_type") + @ExcludeMissing + fun _entryType(): JsonField = entryType /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. */ - fun known(): Known = - when (this) { - REFUND -> Known.REFUND - else -> throw OrbInvalidDataException("Unknown VoidReason: $value") - } + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - fun asString(): String = _value().asStringOrThrow() + /** + * Optional metadata that can be specified when adding ledger results via the API. For + * example, this can be used to note an increment refers to trial credits, or for noting + * corrections as a result of an incident, etc. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): AddAmendmentCreditLedgerEntryRequestParams = apply { + if (validated) { + return@apply } - return /* spotless:off */ other is VoidReason && value == other.value /* spotless:on */ + amount() + blockId() + entryType() + currency() + description() + metadata().ifPresent { it.validate() } + validated = true } - override fun hashCode() = value.hashCode() + fun toBuilder() = Builder().from(this) - override fun toString() = value.toString() - } + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmStatic fun builder() = Builder() } - 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 */ - } + /** A builder for [AddAmendmentCreditLedgerEntryRequestParams]. */ + class Builder internal constructor() { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, blockId, entryType, currency, description, metadata, voidReason, additionalProperties) } - /* spotless:on */ + private var amount: JsonField? = null + private var blockId: JsonField? = null + private var entryType: JsonField? = null + private var currency: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - override fun hashCode(): Int = hashCode + @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() + } - override fun toString() = - "AddVoidCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, voidReason=$voidReason, additionalProperties=$additionalProperties}" - } + /** + * The number of credits to effect. Note that this is required for increment, + * decrement or void operations. + */ + fun amount(amount: Double) = amount(JsonField.of(amount)) - @NoAutoDetect - class AddAmendmentCreditLedgerEntryRequestParams - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - private val amount: JsonField = JsonMissing.of(), - @JsonProperty("block_id") - @ExcludeMissing - private val blockId: JsonField = JsonMissing.of(), - @JsonProperty("entry_type") - @ExcludeMissing - private val entryType: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - private val description: JsonField = JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * The number of credits to effect. Note that this is required for increment, + * decrement or void operations. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } - /** - * The number of credits to effect. Note that this is required for increment, decrement or - * void operations. - */ - fun amount(): Double = amount.getRequired("amount") - - /** The ID of the block to reverse a decrement from. */ - fun blockId(): String = blockId.getRequired("block_id") - - fun entryType(): EntryType = entryType.getRequired("entry_type") - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** - * The number of credits to effect. Note that this is required for increment, decrement or - * void operations. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** The ID of the block to reverse a decrement from. */ - @JsonProperty("block_id") @ExcludeMissing fun _blockId(): JsonField = blockId - - @JsonProperty("entry_type") - @ExcludeMissing - fun _entryType(): JsonField = entryType - - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a real-world - * currency, it must match the customer's invoicing currency. - */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The ID of the block to reverse a decrement from. */ + fun blockId(blockId: String) = blockId(JsonField.of(blockId)) - private var validated: Boolean = false + /** The ID of the block to reverse a decrement from. */ + fun blockId(blockId: JsonField) = apply { this.blockId = blockId } - fun validate(): AddAmendmentCreditLedgerEntryRequestParams = apply { - if (validated) { - return@apply - } + fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) - amount() - blockId() - entryType() - currency() - description() - metadata().ifPresent { it.validate() } - validated = true - } + fun entryType(entryType: JsonField) = apply { + this.entryType = entryType + } - fun toBuilder() = Builder().from(this) + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) - companion object { + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: Optional) = currency(currency.orElse(null)) - @JvmStatic fun builder() = Builder() - } + /** + * The currency or custom pricing unit to use for this ledger entry. If this is a + * real-world currency, it must match the customer's invoicing currency. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** A builder for [AddAmendmentCreditLedgerEntryRequestParams]. */ - class Builder internal constructor() { + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) - private var amount: JsonField? = null - private var blockId: JsonField? = null - private var entryType: JsonField? = null - private var currency: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: Optional) = + description(description.orElse(null)) - @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() + /** + * Optional metadata that can be specified when adding ledger results via the API. + * For example, this can be used to note an increment refers to trial credits, or + * for noting corrections as a result of an incident, etc. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): AddAmendmentCreditLedgerEntryRequestParams = + AddAmendmentCreditLedgerEntryRequestParams( + checkRequired("amount", amount), + checkRequired("blockId", blockId), + checkRequired("entryType", entryType), + currency, + description, + metadata, + additionalProperties.toImmutable(), + ) } - /** - * The number of credits to effect. Note that this is required for increment, decrement - * or void operations. - */ - fun amount(amount: Double) = amount(JsonField.of(amount)) + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** - * The number of credits to effect. Note that this is required for increment, decrement - * or void operations. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** The ID of the block to reverse a decrement from. */ - fun blockId(blockId: String) = blockId(JsonField.of(blockId)) + companion object { - /** The ID of the block to reverse a decrement from. */ - fun blockId(blockId: JsonField) = apply { this.blockId = blockId } + @JvmField val AMENDMENT = of("amendment") - fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType)) + @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) + } - fun entryType(entryType: JsonField) = apply { this.entryType = entryType } + /** An enum containing [EntryType]'s known values. */ + enum class Known { + AMENDMENT + } - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) + /** + * 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, + } - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: Optional) = currency(currency.orElse(null)) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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 + } - /** - * The currency or custom pricing unit to use for this ledger entry. If this is a - * real-world currency, it must match the customer's invoicing currency. - */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to 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") + } - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: String?) = description(JsonField.ofNullable(description)) + fun asString(): String = _value().asStringOrThrow() - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: Optional) = description(description.orElse(null)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * Optional metadata that can be specified when adding ledger results via the API. For - * example, this can be used to note an increment refers to trial credits, or for noting - * corrections as a result of an incident, etc. - */ - fun description(description: JsonField) = apply { - this.description = description + return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } /** @@ -3304,244 +3335,315 @@ private constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + validated = true + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + @JvmStatic fun builder() = Builder() + } - fun build(): AddAmendmentCreditLedgerEntryRequestParams = - AddAmendmentCreditLedgerEntryRequestParams( - checkRequired("amount", amount), - checkRequired("blockId", blockId), - checkRequired("entryType", entryType), - currency, - description, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - companion object { + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JvmField val AMENDMENT = of("amendment") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JvmStatic fun of(value: String) = EntryType(JsonField.of(value)) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** An enum containing [EntryType]'s known values. */ - enum class Known { - AMENDMENT, - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * 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, - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is EntryType && value == other.value /* spotless:on */ + return /* spotless:off */ other is AddAmendmentCreditLedgerEntryRequestParams && amount == other.amount && blockId == other.blockId && entryType == other.entryType && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amount, blockId, entryType, currency, description, metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - override fun toString() = value.toString() + override fun toString() = + "AddAmendmentCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" } + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun toBuilder() = Builder().from(this) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + companion object { - private var validated: Boolean = false + @JvmStatic fun builder() = Builder() + } - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + /** A builder for [CustomerCreditLedgerCreateEntryParams]. */ + @NoAutoDetect + class Builder internal constructor() { - validated = true - } + private var customerId: String? = null + private var body: Body? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - fun toBuilder() = Builder().from(this) + @JvmSynthetic + internal fun from( + customerCreditLedgerCreateEntryParams: CustomerCreditLedgerCreateEntryParams + ) = apply { + customerId = customerCreditLedgerCreateEntryParams.customerId + body = customerCreditLedgerCreateEntryParams.body + additionalHeaders = customerCreditLedgerCreateEntryParams.additionalHeaders.toBuilder() + additionalQueryParams = + customerCreditLedgerCreateEntryParams.additionalQueryParams.toBuilder() + } - companion object { + fun customerId(customerId: String) = apply { this.customerId = customerId } - @JvmStatic fun builder() = Builder() - } + fun body(body: Body) = apply { this.body = body } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun body( + addIncrementCreditLedgerEntryRequestParams: + Body.AddIncrementCreditLedgerEntryRequestParams + ) = + body( + Body.ofAddIncrementCreditLedgerEntryRequestParams( + addIncrementCreditLedgerEntryRequestParams + ) + ) - private var additionalProperties: MutableMap = mutableMapOf() + fun addIncrementCreditLedgerEntryRequestParamsBody(amount: Double) = + body( + Body.AddIncrementCreditLedgerEntryRequestParams.builder() + .entryType( + CustomerCreditLedgerCreateEntryParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .EntryType + .INCREMENT + ) + .amount(amount) + .build() + ) - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + fun body( + addDecrementCreditLedgerEntryRequestParams: + Body.AddDecrementCreditLedgerEntryRequestParams + ) = + body( + Body.ofAddDecrementCreditLedgerEntryRequestParams( + addDecrementCreditLedgerEntryRequestParams + ) + ) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun addDecrementCreditLedgerEntryRequestParamsBody(amount: Double) = + body( + Body.AddDecrementCreditLedgerEntryRequestParams.builder() + .entryType( + CustomerCreditLedgerCreateEntryParams.Body + .AddDecrementCreditLedgerEntryRequestParams + .EntryType + .DECREMENT + ) + .amount(amount) + .build() + ) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun body( + addExpirationChangeCreditLedgerEntryRequestParams: + Body.AddExpirationChangeCreditLedgerEntryRequestParams + ) = + body( + Body.ofAddExpirationChangeCreditLedgerEntryRequestParams( + addExpirationChangeCreditLedgerEntryRequestParams + ) + ) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun body( + addVoidCreditLedgerEntryRequestParams: Body.AddVoidCreditLedgerEntryRequestParams + ) = + body( + Body.ofAddVoidCreditLedgerEntryRequestParams(addVoidCreditLedgerEntryRequestParams) + ) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + fun body( + addAmendmentCreditLedgerEntryRequestParams: + Body.AddAmendmentCreditLedgerEntryRequestParams + ) = + body( + Body.ofAddAmendmentCreditLedgerEntryRequestParams( + addAmendmentCreditLedgerEntryRequestParams + ) + ) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } - override fun hashCode(): Int = hashCode + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) } - 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 */ + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, blockId, entryType, currency, description, metadata, additionalProperties) } - /* spotless:on */ + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - override fun hashCode(): Int = hashCode + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } - override fun toString() = - "AddAmendmentCreditLedgerEntryRequestParams{amount=$amount, blockId=$blockId, entryType=$entryType, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" + fun build(): CustomerCreditLedgerCreateEntryParams = + CustomerCreditLedgerCreateEntryParams( + checkRequired("customerId", customerId), + checkRequired("body", body), + additionalHeaders.build(), + additionalQueryParams.build(), + ) } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponse.kt index c2928511..f899eaa2 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 @@ -296,7 +296,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryResponse( incrementLedgerEntry = it, - _json = json + _json = json, ) } } @@ -305,7 +305,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryResponse( decrementLedgerEntry = it, - _json = json + _json = json, ) } } @@ -316,7 +316,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryResponse( expirationChangeLedgerEntry = it, - _json = json + _json = json, ) } } @@ -327,7 +327,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryResponse( creditBlockExpiryLedgerEntry = it, - _json = json + _json = json, ) } } @@ -336,7 +336,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryResponse( voidLedgerEntry = it, - _json = json + _json = json, ) } } @@ -347,7 +347,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryResponse( voidInitiatedLedgerEntry = it, - _json = json + _json = json, ) } } @@ -356,7 +356,7 @@ private constructor( ?.let { return CustomerCreditLedgerCreateEntryResponse( amendmentLedgerEntry = it, - _json = json + _json = json, ) } } @@ -374,7 +374,7 @@ private constructor( override fun serialize( value: CustomerCreditLedgerCreateEntryResponse, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.incrementLedgerEntry != null -> @@ -982,11 +982,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1077,11 +1074,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1102,7 +1096,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - INCREMENT, + INCREMENT } /** @@ -1176,7 +1170,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -1906,11 +1900,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2001,11 +1992,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2026,7 +2014,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - DECREMENT, + DECREMENT } /** @@ -2100,7 +2088,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -2804,11 +2792,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2899,11 +2884,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2924,7 +2906,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - EXPIRATION_CHANGE, + EXPIRATION_CHANGE } /** @@ -2998,7 +2980,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -3678,11 +3660,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3773,11 +3752,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3798,7 +3774,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - CREDIT_BLOCK_EXPIRY, + CREDIT_BLOCK_EXPIRY } /** @@ -3872,7 +3848,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -4588,11 +4564,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4683,11 +4656,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4708,7 +4678,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - VOID, + VOID } /** @@ -4782,7 +4752,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -5519,11 +5489,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5614,11 +5581,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5639,7 +5603,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - VOID_INITIATED, + VOID_INITIATED } /** @@ -5713,7 +5677,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6392,11 +6356,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6487,11 +6448,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6512,7 +6470,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - AMENDMENT, + AMENDMENT } /** @@ -6586,7 +6544,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 0832108c..58e689fc 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 @@ -155,13 +155,8 @@ private constructor( fun of( ledgerService: LedgerService, params: CustomerCreditLedgerListByExternalIdParams, - response: Response - ) = - CustomerCreditLedgerListByExternalIdPage( - ledgerService, - params, - response, - ) + response: Response, + ) = CustomerCreditLedgerListByExternalIdPage(ledgerService, params, response) } @NoAutoDetect @@ -259,18 +254,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerCreditLedgerListByExternalIdPage, - ) : Iterable { + class AutoPager(private val firstPage: CustomerCreditLedgerListByExternalIdPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 6a294e96..6951afb9 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 @@ -158,13 +158,8 @@ private constructor( fun of( ledgerService: LedgerServiceAsync, params: CustomerCreditLedgerListByExternalIdParams, - response: Response - ) = - CustomerCreditLedgerListByExternalIdPageAsync( - ledgerService, - params, - response, - ) + response: Response, + ) = CustomerCreditLedgerListByExternalIdPageAsync(ledgerService, params, response) } @NoAutoDetect @@ -262,26 +257,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerCreditLedgerListByExternalIdPageAsync, - ) { + class AutoPager(private val firstPage: CustomerCreditLedgerListByExternalIdPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (CustomerCreditLedgerListByExternalIdResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -290,7 +278,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 e2806d76..86807395 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 @@ -149,25 +149,25 @@ private constructor( this.createdAtGt?.let { queryParams.put( "created_at[gt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtGte?.let { queryParams.put( "created_at[gte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLt?.let { queryParams.put( "created_at[lt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLte?.let { queryParams.put( "created_at[lte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.currency?.let { queryParams.put("currency", listOf(it.toString())) } @@ -414,11 +414,8 @@ private constructor( ) } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -507,11 +504,7 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 cf965a98..d89bdab0 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 @@ -305,7 +305,7 @@ private constructor( ?.let { return CustomerCreditLedgerListByExternalIdResponse( incrementLedgerEntry = it, - _json = json + _json = json, ) } } @@ -314,7 +314,7 @@ private constructor( ?.let { return CustomerCreditLedgerListByExternalIdResponse( decrementLedgerEntry = it, - _json = json + _json = json, ) } } @@ -325,7 +325,7 @@ private constructor( ?.let { return CustomerCreditLedgerListByExternalIdResponse( expirationChangeLedgerEntry = it, - _json = json + _json = json, ) } } @@ -336,7 +336,7 @@ private constructor( ?.let { return CustomerCreditLedgerListByExternalIdResponse( creditBlockExpiryLedgerEntry = it, - _json = json + _json = json, ) } } @@ -345,7 +345,7 @@ private constructor( ?.let { return CustomerCreditLedgerListByExternalIdResponse( voidLedgerEntry = it, - _json = json + _json = json, ) } } @@ -356,7 +356,7 @@ private constructor( ?.let { return CustomerCreditLedgerListByExternalIdResponse( voidInitiatedLedgerEntry = it, - _json = json + _json = json, ) } } @@ -365,7 +365,7 @@ private constructor( ?.let { return CustomerCreditLedgerListByExternalIdResponse( amendmentLedgerEntry = it, - _json = json + _json = json, ) } } @@ -383,7 +383,7 @@ private constructor( override fun serialize( value: CustomerCreditLedgerListByExternalIdResponse, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.incrementLedgerEntry != null -> @@ -993,11 +993,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1088,11 +1085,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1113,7 +1107,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - INCREMENT, + INCREMENT } /** @@ -1187,7 +1181,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -1917,11 +1911,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2012,11 +2003,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2037,7 +2025,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - DECREMENT, + DECREMENT } /** @@ -2111,7 +2099,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -2815,11 +2803,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2910,11 +2895,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2935,7 +2917,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - EXPIRATION_CHANGE, + EXPIRATION_CHANGE } /** @@ -3009,7 +2991,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -3689,11 +3671,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3784,11 +3763,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3809,7 +3785,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - CREDIT_BLOCK_EXPIRY, + CREDIT_BLOCK_EXPIRY } /** @@ -3883,7 +3859,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -4599,11 +4575,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4694,11 +4667,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4719,7 +4689,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - VOID, + VOID } /** @@ -4793,7 +4763,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -5530,11 +5500,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5625,11 +5592,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5650,7 +5614,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - VOID_INITIATED, + VOID_INITIATED } /** @@ -5724,7 +5688,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6403,11 +6367,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6498,11 +6459,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6523,7 +6481,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - AMENDMENT, + AMENDMENT } /** @@ -6597,7 +6555,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 10c6f062..c134f817 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 @@ -155,13 +155,8 @@ private constructor( fun of( ledgerService: LedgerService, params: CustomerCreditLedgerListParams, - response: Response - ) = - CustomerCreditLedgerListPage( - ledgerService, - params, - response, - ) + response: Response, + ) = CustomerCreditLedgerListPage(ledgerService, params, response) } @NoAutoDetect @@ -255,18 +250,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerCreditLedgerListPage, - ) : Iterable { + class AutoPager(private val firstPage: CustomerCreditLedgerListPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 b8c2b7c9..07722d0e 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 @@ -158,13 +158,8 @@ private constructor( fun of( ledgerService: LedgerServiceAsync, params: CustomerCreditLedgerListParams, - response: Response - ) = - CustomerCreditLedgerListPageAsync( - ledgerService, - params, - response, - ) + response: Response, + ) = CustomerCreditLedgerListPageAsync(ledgerService, params, response) } @NoAutoDetect @@ -258,26 +253,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerCreditLedgerListPageAsync, - ) { + class AutoPager(private val firstPage: CustomerCreditLedgerListPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (CustomerCreditLedgerListResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -286,7 +274,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 3153bab1..edc3a0ac 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 @@ -149,25 +149,25 @@ private constructor( this.createdAtGt?.let { queryParams.put( "created_at[gt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtGte?.let { queryParams.put( "created_at[gte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLt?.let { queryParams.put( "created_at[lt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLte?.let { queryParams.put( "created_at[lte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.currency?.let { queryParams.put("currency", listOf(it.toString())) } @@ -408,11 +408,8 @@ private constructor( ) } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -501,11 +498,7 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 113f899c..7089b8d8 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 @@ -291,7 +291,7 @@ private constructor( ?.let { return CustomerCreditLedgerListResponse( incrementLedgerEntry = it, - _json = json + _json = json, ) } } @@ -300,7 +300,7 @@ private constructor( ?.let { return CustomerCreditLedgerListResponse( decrementLedgerEntry = it, - _json = json + _json = json, ) } } @@ -311,7 +311,7 @@ private constructor( ?.let { return CustomerCreditLedgerListResponse( expirationChangeLedgerEntry = it, - _json = json + _json = json, ) } } @@ -322,7 +322,7 @@ private constructor( ?.let { return CustomerCreditLedgerListResponse( creditBlockExpiryLedgerEntry = it, - _json = json + _json = json, ) } } @@ -331,7 +331,7 @@ private constructor( ?.let { return CustomerCreditLedgerListResponse( voidLedgerEntry = it, - _json = json + _json = json, ) } } @@ -342,7 +342,7 @@ private constructor( ?.let { return CustomerCreditLedgerListResponse( voidInitiatedLedgerEntry = it, - _json = json + _json = json, ) } } @@ -351,7 +351,7 @@ private constructor( ?.let { return CustomerCreditLedgerListResponse( amendmentLedgerEntry = it, - _json = json + _json = json, ) } } @@ -367,7 +367,7 @@ private constructor( override fun serialize( value: CustomerCreditLedgerListResponse, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.incrementLedgerEntry != null -> @@ -974,11 +974,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1069,11 +1066,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1094,7 +1088,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - INCREMENT, + INCREMENT } /** @@ -1168,7 +1162,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -1898,11 +1892,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1993,11 +1984,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2018,7 +2006,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - DECREMENT, + DECREMENT } /** @@ -2092,7 +2080,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -2796,11 +2784,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2891,11 +2876,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2916,7 +2898,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - EXPIRATION_CHANGE, + EXPIRATION_CHANGE } /** @@ -2990,7 +2972,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -3670,11 +3652,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3765,11 +3744,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3790,7 +3766,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - CREDIT_BLOCK_EXPIRY, + CREDIT_BLOCK_EXPIRY } /** @@ -3864,7 +3840,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -4580,11 +4556,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4675,11 +4648,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4700,7 +4670,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - VOID, + VOID } /** @@ -4774,7 +4744,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -5511,11 +5481,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5606,11 +5573,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5631,7 +5595,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - VOID_INITIATED, + VOID_INITIATED } /** @@ -5705,7 +5669,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6384,11 +6348,8 @@ private constructor( "Customer{id=$id, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - class EntryStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6479,11 +6440,8 @@ private constructor( override fun toString() = value.toString() } - class EntryType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EntryType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6504,7 +6462,7 @@ private constructor( /** An enum containing [EntryType]'s known values. */ enum class Known { - AMENDMENT, + AMENDMENT } /** @@ -6578,7 +6536,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 6cb721a7..b3bb50bc 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 @@ -87,13 +87,8 @@ private constructor( fun of( creditsService: CreditService, params: CustomerCreditListByExternalIdParams, - response: Response - ) = - CustomerCreditListByExternalIdPage( - creditsService, - params, - response, - ) + response: Response, + ) = CustomerCreditListByExternalIdPage(creditsService, params, response) } @NoAutoDetect @@ -190,18 +185,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerCreditListByExternalIdPage, - ) : Iterable { + class AutoPager(private val firstPage: CustomerCreditListByExternalIdPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 652fcd3d..0a35cfee 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 @@ -90,13 +90,8 @@ private constructor( fun of( creditsService: CreditServiceAsync, params: CustomerCreditListByExternalIdParams, - response: Response - ) = - CustomerCreditListByExternalIdPageAsync( - creditsService, - params, - response, - ) + response: Response, + ) = CustomerCreditListByExternalIdPageAsync(creditsService, params, response) } @NoAutoDetect @@ -193,26 +188,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerCreditListByExternalIdPageAsync, - ) { + class AutoPager(private val firstPage: CustomerCreditListByExternalIdPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (CustomerCreditListByExternalIdResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -221,7 +209,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdResponse.kt index 8afc939e..6f196e40 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdResponse.kt @@ -227,11 +227,7 @@ private constructor( ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 3b8d836f..e56ae567 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 @@ -87,13 +87,8 @@ private constructor( fun of( creditsService: CreditService, params: CustomerCreditListParams, - response: Response - ) = - CustomerCreditListPage( - creditsService, - params, - response, - ) + response: Response, + ) = CustomerCreditListPage(creditsService, params, response) } @NoAutoDetect @@ -185,18 +180,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerCreditListPage, - ) : Iterable { + class AutoPager(private val firstPage: CustomerCreditListPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 2b3725b0..fe9a9f29 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 @@ -90,13 +90,8 @@ private constructor( fun of( creditsService: CreditServiceAsync, params: CustomerCreditListParams, - response: Response - ) = - CustomerCreditListPageAsync( - creditsService, - params, - response, - ) + response: Response, + ) = CustomerCreditListPageAsync(creditsService, params, response) } @NoAutoDetect @@ -188,26 +183,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerCreditListPageAsync, - ) { + class AutoPager(private val firstPage: CustomerCreditListPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (CustomerCreditListResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -216,7 +204,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListResponse.kt index dc09b400..63877116 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListResponse.kt @@ -224,11 +224,7 @@ private constructor( ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 22f806fb..f1934709 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 @@ -33,7 +33,7 @@ import java.util.Optional class CustomerCreditTopUpCreateByExternalIdParams private constructor( private val externalCustomerId: String, - private val body: CustomerCreditTopUpCreateByExternalIdBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -106,7 +106,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): CustomerCreditTopUpCreateByExternalIdBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -120,9 +120,9 @@ private constructor( } @NoAutoDetect - class CustomerCreditTopUpCreateByExternalIdBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), @@ -224,7 +224,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CustomerCreditTopUpCreateByExternalIdBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -246,7 +246,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CustomerCreditTopUpCreateByExternalIdBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -259,18 +259,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - customerCreditTopUpCreateByExternalIdBody: CustomerCreditTopUpCreateByExternalIdBody - ) = apply { - amount = customerCreditTopUpCreateByExternalIdBody.amount - currency = customerCreditTopUpCreateByExternalIdBody.currency - invoiceSettings = customerCreditTopUpCreateByExternalIdBody.invoiceSettings - perUnitCostBasis = customerCreditTopUpCreateByExternalIdBody.perUnitCostBasis - threshold = customerCreditTopUpCreateByExternalIdBody.threshold - expiresAfter = customerCreditTopUpCreateByExternalIdBody.expiresAfter - expiresAfterUnit = customerCreditTopUpCreateByExternalIdBody.expiresAfterUnit - additionalProperties = - customerCreditTopUpCreateByExternalIdBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + amount = body.amount + currency = body.currency + invoiceSettings = body.invoiceSettings + perUnitCostBasis = body.perUnitCostBasis + threshold = body.threshold + expiresAfter = body.expiresAfter + expiresAfterUnit = body.expiresAfterUnit + additionalProperties = body.additionalProperties.toMutableMap() } /** The amount to increment when the threshold is reached. */ @@ -381,8 +378,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CustomerCreditTopUpCreateByExternalIdBody = - CustomerCreditTopUpCreateByExternalIdBody( + fun build(): Body = + Body( checkRequired("amount", amount), checkRequired("currency", currency), checkRequired("invoiceSettings", invoiceSettings), @@ -399,7 +396,7 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreditTopUpCreateByExternalIdBody && amount == other.amount && currency == other.currency && invoiceSettings == other.invoiceSettings && perUnitCostBasis == other.perUnitCostBasis && threshold == other.threshold && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && amount == other.amount && currency == other.currency && invoiceSettings == other.invoiceSettings && perUnitCostBasis == other.perUnitCostBasis && threshold == other.threshold && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -409,7 +406,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CustomerCreditTopUpCreateByExternalIdBody{amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" + "Body{amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -424,8 +421,7 @@ private constructor( class Builder internal constructor() { private var externalCustomerId: String? = null - private var body: CustomerCreditTopUpCreateByExternalIdBody.Builder = - CustomerCreditTopUpCreateByExternalIdBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -871,11 +867,8 @@ private constructor( } /** The unit of expires_after. */ - class ExpiresAfterUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ExpiresAfterUnit @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt index 0f26331f..c09cbb41 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt @@ -515,11 +515,8 @@ private constructor( } /** The unit of expires_after. */ - class ExpiresAfterUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ExpiresAfterUnit @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. 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 57894aa6..abb7f19f 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 @@ -33,7 +33,7 @@ import java.util.Optional class CustomerCreditTopUpCreateParams private constructor( private val customerId: String, - private val body: CustomerCreditTopUpCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -106,7 +106,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): CustomerCreditTopUpCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -120,9 +120,9 @@ private constructor( } @NoAutoDetect - class CustomerCreditTopUpCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), @@ -224,7 +224,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CustomerCreditTopUpCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -246,7 +246,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CustomerCreditTopUpCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -259,18 +259,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(customerCreditTopUpCreateBody: CustomerCreditTopUpCreateBody) = - apply { - amount = customerCreditTopUpCreateBody.amount - currency = customerCreditTopUpCreateBody.currency - invoiceSettings = customerCreditTopUpCreateBody.invoiceSettings - perUnitCostBasis = customerCreditTopUpCreateBody.perUnitCostBasis - threshold = customerCreditTopUpCreateBody.threshold - expiresAfter = customerCreditTopUpCreateBody.expiresAfter - expiresAfterUnit = customerCreditTopUpCreateBody.expiresAfterUnit - additionalProperties = - customerCreditTopUpCreateBody.additionalProperties.toMutableMap() - } + internal fun from(body: Body) = apply { + amount = body.amount + currency = body.currency + invoiceSettings = body.invoiceSettings + perUnitCostBasis = body.perUnitCostBasis + threshold = body.threshold + expiresAfter = body.expiresAfter + expiresAfterUnit = body.expiresAfterUnit + additionalProperties = body.additionalProperties.toMutableMap() + } /** The amount to increment when the threshold is reached. */ fun amount(amount: String) = amount(JsonField.of(amount)) @@ -380,8 +378,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CustomerCreditTopUpCreateBody = - CustomerCreditTopUpCreateBody( + fun build(): Body = + Body( checkRequired("amount", amount), checkRequired("currency", currency), checkRequired("invoiceSettings", invoiceSettings), @@ -398,7 +396,7 @@ private constructor( return true } - return /* spotless:off */ other is CustomerCreditTopUpCreateBody && amount == other.amount && currency == other.currency && invoiceSettings == other.invoiceSettings && perUnitCostBasis == other.perUnitCostBasis && threshold == other.threshold && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && amount == other.amount && currency == other.currency && invoiceSettings == other.invoiceSettings && perUnitCostBasis == other.perUnitCostBasis && threshold == other.threshold && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -408,7 +406,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CustomerCreditTopUpCreateBody{amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" + "Body{amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -423,8 +421,7 @@ private constructor( class Builder internal constructor() { private var customerId: String? = null - private var body: CustomerCreditTopUpCreateBody.Builder = - CustomerCreditTopUpCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -866,11 +863,8 @@ private constructor( } /** The unit of expires_after. */ - class ExpiresAfterUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ExpiresAfterUnit @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt index d6e33542..85667441 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt @@ -513,11 +513,8 @@ private constructor( } /** The unit of expires_after. */ - class ExpiresAfterUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ExpiresAfterUnit @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. 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 865ea775..db1d259a 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 @@ -79,13 +79,8 @@ private constructor( fun of( topUpsService: TopUpService, params: CustomerCreditTopUpListByExternalIdParams, - response: Response - ) = - CustomerCreditTopUpListByExternalIdPage( - topUpsService, - params, - response, - ) + response: Response, + ) = CustomerCreditTopUpListByExternalIdPage(topUpsService, params, response) } @NoAutoDetect @@ -183,18 +178,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerCreditTopUpListByExternalIdPage, - ) : Iterable { + class AutoPager(private val firstPage: CustomerCreditTopUpListByExternalIdPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 954301ca..cd794286 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 @@ -82,13 +82,8 @@ private constructor( fun of( topUpsService: TopUpServiceAsync, params: CustomerCreditTopUpListByExternalIdParams, - response: Response - ) = - CustomerCreditTopUpListByExternalIdPageAsync( - topUpsService, - params, - response, - ) + response: Response, + ) = CustomerCreditTopUpListByExternalIdPageAsync(topUpsService, params, response) } @NoAutoDetect @@ -186,26 +181,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerCreditTopUpListByExternalIdPageAsync, - ) { + class AutoPager(private val firstPage: CustomerCreditTopUpListByExternalIdPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (CustomerCreditTopUpListByExternalIdResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -214,7 +202,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdResponse.kt index eccfbc27..0bf1a099 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdResponse.kt @@ -514,11 +514,8 @@ private constructor( } /** The unit of expires_after. */ - class ExpiresAfterUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ExpiresAfterUnit @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. 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 107ad071..696d7a99 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 @@ -79,13 +79,8 @@ private constructor( fun of( topUpsService: TopUpService, params: CustomerCreditTopUpListParams, - response: Response - ) = - CustomerCreditTopUpListPage( - topUpsService, - params, - response, - ) + response: Response, + ) = CustomerCreditTopUpListPage(topUpsService, params, response) } @NoAutoDetect @@ -179,18 +174,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerCreditTopUpListPage, - ) : Iterable { + class AutoPager(private val firstPage: CustomerCreditTopUpListPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 9440c8f5..20b9b182 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 @@ -82,13 +82,8 @@ private constructor( fun of( topUpsService: TopUpServiceAsync, params: CustomerCreditTopUpListParams, - response: Response - ) = - CustomerCreditTopUpListPageAsync( - topUpsService, - params, - response, - ) + response: Response, + ) = CustomerCreditTopUpListPageAsync(topUpsService, params, response) } @NoAutoDetect @@ -182,26 +177,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerCreditTopUpListPageAsync, - ) { + class AutoPager(private val firstPage: CustomerCreditTopUpListPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (CustomerCreditTopUpListResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -210,7 +198,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListResponse.kt index 731749d7..28eae786 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListResponse.kt @@ -513,11 +513,8 @@ private constructor( } /** The unit of expires_after. */ - class ExpiresAfterUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ExpiresAfterUnit @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. 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 d06ebd82..84452eb5 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 @@ -83,11 +83,7 @@ private constructor( @JvmStatic fun of(customersService: CustomerService, params: CustomerListParams, response: Response) = - CustomerListPage( - customersService, - params, - response, - ) + CustomerListPage(customersService, params, response) } @NoAutoDetect @@ -177,18 +173,11 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerListPage, - ) : Iterable { + class AutoPager(private val firstPage: CustomerListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 8bd5fdd0..eaac458f 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 @@ -88,13 +88,8 @@ private constructor( fun of( customersService: CustomerServiceAsync, params: CustomerListParams, - response: Response - ) = - CustomerListPageAsync( - customersService, - params, - response, - ) + response: Response, + ) = CustomerListPageAsync(customersService, params, response) } @NoAutoDetect @@ -184,23 +179,16 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: CustomerListPageAsync, - ) { + class AutoPager(private val firstPage: CustomerListPageAsync) { fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( action: (Customer) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -209,7 +197,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt index f5da69ab..eebdf728 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt @@ -58,25 +58,25 @@ private constructor( this.createdAtGt?.let { queryParams.put( "created_at[gt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtGte?.let { queryParams.put( "created_at[gte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLt?.let { queryParams.put( "created_at[lt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLte?.let { queryParams.put( "created_at[lte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) } 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 3b8a762b..390d6fe9 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 @@ -41,7 +41,7 @@ import kotlin.jvm.optionals.getOrNull class CustomerUpdateByExternalIdParams private constructor( private val id: String, - private val body: CustomerUpdateByExternalIdBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -403,7 +403,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): CustomerUpdateByExternalIdBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -417,9 +417,9 @@ private constructor( } @NoAutoDetect - class CustomerUpdateByExternalIdBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("accounting_sync_configuration") @ExcludeMissing private val accountingSyncConfiguration: JsonField = @@ -861,7 +861,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CustomerUpdateByExternalIdBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -892,7 +892,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CustomerUpdateByExternalIdBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var accountingSyncConfiguration: JsonField = @@ -915,29 +915,25 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(customerUpdateByExternalIdBody: CustomerUpdateByExternalIdBody) = - apply { - accountingSyncConfiguration = - customerUpdateByExternalIdBody.accountingSyncConfiguration - additionalEmails = - customerUpdateByExternalIdBody.additionalEmails.map { it.toMutableList() } - autoCollection = customerUpdateByExternalIdBody.autoCollection - billingAddress = customerUpdateByExternalIdBody.billingAddress - currency = customerUpdateByExternalIdBody.currency - email = customerUpdateByExternalIdBody.email - emailDelivery = customerUpdateByExternalIdBody.emailDelivery - externalCustomerId = customerUpdateByExternalIdBody.externalCustomerId - metadata = customerUpdateByExternalIdBody.metadata - name = customerUpdateByExternalIdBody.name - paymentProvider = customerUpdateByExternalIdBody.paymentProvider - paymentProviderId = customerUpdateByExternalIdBody.paymentProviderId - reportingConfiguration = customerUpdateByExternalIdBody.reportingConfiguration - shippingAddress = customerUpdateByExternalIdBody.shippingAddress - taxConfiguration = customerUpdateByExternalIdBody.taxConfiguration - taxId = customerUpdateByExternalIdBody.taxId - additionalProperties = - customerUpdateByExternalIdBody.additionalProperties.toMutableMap() - } + internal fun from(body: Body) = apply { + accountingSyncConfiguration = body.accountingSyncConfiguration + additionalEmails = body.additionalEmails.map { it.toMutableList() } + autoCollection = body.autoCollection + billingAddress = body.billingAddress + currency = body.currency + email = body.email + emailDelivery = body.emailDelivery + externalCustomerId = body.externalCustomerId + metadata = body.metadata + name = body.name + paymentProvider = body.paymentProvider + paymentProviderId = body.paymentProviderId + reportingConfiguration = body.reportingConfiguration + shippingAddress = body.shippingAddress + taxConfiguration = body.taxConfiguration + taxId = body.taxId + additionalProperties = body.additionalProperties.toMutableMap() + } fun accountingSyncConfiguration( accountingSyncConfiguration: AccountingSyncConfiguration? @@ -1586,8 +1582,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CustomerUpdateByExternalIdBody = - CustomerUpdateByExternalIdBody( + fun build(): Body = + Body( accountingSyncConfiguration, (additionalEmails ?: JsonMissing.of()).map { it.toImmutable() }, autoCollection, @@ -1613,7 +1609,7 @@ private constructor( return true } - return /* spotless:off */ other is CustomerUpdateByExternalIdBody && accountingSyncConfiguration == other.accountingSyncConfiguration && additionalEmails == other.additionalEmails && autoCollection == other.autoCollection && billingAddress == other.billingAddress && currency == other.currency && email == other.email && emailDelivery == other.emailDelivery && externalCustomerId == other.externalCustomerId && metadata == other.metadata && name == other.name && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && reportingConfiguration == other.reportingConfiguration && shippingAddress == other.shippingAddress && taxConfiguration == other.taxConfiguration && taxId == other.taxId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && accountingSyncConfiguration == other.accountingSyncConfiguration && additionalEmails == other.additionalEmails && autoCollection == other.autoCollection && billingAddress == other.billingAddress && currency == other.currency && email == other.email && emailDelivery == other.emailDelivery && externalCustomerId == other.externalCustomerId && metadata == other.metadata && name == other.name && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && reportingConfiguration == other.reportingConfiguration && shippingAddress == other.shippingAddress && taxConfiguration == other.taxConfiguration && taxId == other.taxId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1623,7 +1619,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CustomerUpdateByExternalIdBody{accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, email=$email, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, additionalProperties=$additionalProperties}" + "Body{accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, email=$email, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -1638,8 +1634,7 @@ private constructor( class Builder internal constructor() { private var id: String? = null - private var body: CustomerUpdateByExternalIdBody.Builder = - CustomerUpdateByExternalIdBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -2853,7 +2848,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -2933,11 +2928,8 @@ private constructor( * - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, `bill.com`, * `netsuite`), any product mappings must first be configured with the Orb team. */ - class PaymentProvider - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PaymentProvider @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3120,7 +3112,7 @@ private constructor( fun build(): ReportingConfiguration = ReportingConfiguration( checkRequired("exempt", exempt), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -3470,7 +3462,7 @@ private constructor( override fun serialize( value: TaxConfiguration, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newAvalara != null -> generator.writeObject(value.newAvalara) @@ -3611,9 +3603,7 @@ private constructor( class TaxProvider @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3634,7 +3624,7 @@ private constructor( /** An enum containing [TaxProvider]'s known values. */ enum class Known { - AVALARA, + AVALARA } /** @@ -3822,9 +3812,7 @@ private constructor( class TaxProvider @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3845,7 +3833,7 @@ private constructor( /** An enum containing [TaxProvider]'s known values. */ enum class Known { - TAXJAR, + TAXJAR } /** @@ -4141,11 +4129,8 @@ private constructor( ) } - class Country - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Country @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4691,11 +4676,7 @@ private constructor( override fun toString() = value.toString() } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 20682b53..8b55e6ad 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 @@ -42,7 +42,7 @@ import kotlin.jvm.optionals.getOrNull class CustomerUpdateParams private constructor( private val customerId: String, - private val body: CustomerUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -404,7 +404,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): CustomerUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -418,9 +418,9 @@ private constructor( } @NoAutoDetect - class CustomerUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("accounting_sync_configuration") @ExcludeMissing private val accountingSyncConfiguration: JsonField = @@ -862,7 +862,7 @@ private constructor( private var validated: Boolean = false - fun validate(): CustomerUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -893,7 +893,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CustomerUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var accountingSyncConfiguration: JsonField = @@ -916,24 +916,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(customerUpdateBody: CustomerUpdateBody) = apply { - accountingSyncConfiguration = customerUpdateBody.accountingSyncConfiguration - additionalEmails = customerUpdateBody.additionalEmails.map { it.toMutableList() } - autoCollection = customerUpdateBody.autoCollection - billingAddress = customerUpdateBody.billingAddress - currency = customerUpdateBody.currency - email = customerUpdateBody.email - emailDelivery = customerUpdateBody.emailDelivery - externalCustomerId = customerUpdateBody.externalCustomerId - metadata = customerUpdateBody.metadata - name = customerUpdateBody.name - paymentProvider = customerUpdateBody.paymentProvider - paymentProviderId = customerUpdateBody.paymentProviderId - reportingConfiguration = customerUpdateBody.reportingConfiguration - shippingAddress = customerUpdateBody.shippingAddress - taxConfiguration = customerUpdateBody.taxConfiguration - taxId = customerUpdateBody.taxId - additionalProperties = customerUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + accountingSyncConfiguration = body.accountingSyncConfiguration + additionalEmails = body.additionalEmails.map { it.toMutableList() } + autoCollection = body.autoCollection + billingAddress = body.billingAddress + currency = body.currency + email = body.email + emailDelivery = body.emailDelivery + externalCustomerId = body.externalCustomerId + metadata = body.metadata + name = body.name + paymentProvider = body.paymentProvider + paymentProviderId = body.paymentProviderId + reportingConfiguration = body.reportingConfiguration + shippingAddress = body.shippingAddress + taxConfiguration = body.taxConfiguration + taxId = body.taxId + additionalProperties = body.additionalProperties.toMutableMap() } fun accountingSyncConfiguration( @@ -1581,8 +1581,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CustomerUpdateBody = - CustomerUpdateBody( + fun build(): Body = + Body( accountingSyncConfiguration, (additionalEmails ?: JsonMissing.of()).map { it.toImmutable() }, autoCollection, @@ -1608,7 +1608,7 @@ private constructor( return true } - return /* spotless:off */ other is CustomerUpdateBody && accountingSyncConfiguration == other.accountingSyncConfiguration && additionalEmails == other.additionalEmails && autoCollection == other.autoCollection && billingAddress == other.billingAddress && currency == other.currency && email == other.email && emailDelivery == other.emailDelivery && externalCustomerId == other.externalCustomerId && metadata == other.metadata && name == other.name && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && reportingConfiguration == other.reportingConfiguration && shippingAddress == other.shippingAddress && taxConfiguration == other.taxConfiguration && taxId == other.taxId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && accountingSyncConfiguration == other.accountingSyncConfiguration && additionalEmails == other.additionalEmails && autoCollection == other.autoCollection && billingAddress == other.billingAddress && currency == other.currency && email == other.email && emailDelivery == other.emailDelivery && externalCustomerId == other.externalCustomerId && metadata == other.metadata && name == other.name && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && reportingConfiguration == other.reportingConfiguration && shippingAddress == other.shippingAddress && taxConfiguration == other.taxConfiguration && taxId == other.taxId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1618,7 +1618,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CustomerUpdateBody{accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, email=$email, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, additionalProperties=$additionalProperties}" + "Body{accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, email=$email, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -1633,7 +1633,7 @@ private constructor( class Builder internal constructor() { private var customerId: String? = null - private var body: CustomerUpdateBody.Builder = CustomerUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -2845,7 +2845,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -2925,11 +2925,8 @@ private constructor( * - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, `bill.com`, * `netsuite`), any product mappings must first be configured with the Orb team. */ - class PaymentProvider - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PaymentProvider @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3112,7 +3109,7 @@ private constructor( fun build(): ReportingConfiguration = ReportingConfiguration( checkRequired("exempt", exempt), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -3462,7 +3459,7 @@ private constructor( override fun serialize( value: TaxConfiguration, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newAvalara != null -> generator.writeObject(value.newAvalara) @@ -3603,9 +3600,7 @@ private constructor( class TaxProvider @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3626,7 +3621,7 @@ private constructor( /** An enum containing [TaxProvider]'s known values. */ enum class Known { - AVALARA, + AVALARA } /** @@ -3814,9 +3809,7 @@ private constructor( class TaxProvider @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3837,7 +3830,7 @@ private constructor( /** An enum containing [TaxProvider]'s known values. */ enum class Known { - TAXJAR, + TAXJAR } /** @@ -4133,11 +4126,8 @@ private constructor( ) } - class Country - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Country @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4683,11 +4673,7 @@ private constructor( override fun toString() = value.toString() } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroup.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroup.kt index 1b91e8ff..8df86a0f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroup.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroup.kt @@ -264,7 +264,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt index fcb64384..7a846de4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt @@ -31,7 +31,7 @@ import java.util.Optional */ class DimensionalPriceGroupCreateParams private constructor( - private val body: DimensionalPriceGroupCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -75,16 +75,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): DimensionalPriceGroupCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class DimensionalPriceGroupCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("billable_metric_id") @ExcludeMissing private val billableMetricId: JsonField = JsonMissing.of(), @@ -151,7 +151,7 @@ private constructor( private var validated: Boolean = false - fun validate(): DimensionalPriceGroupCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -171,7 +171,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [DimensionalPriceGroupCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var billableMetricId: JsonField? = null @@ -182,18 +182,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(dimensionalPriceGroupCreateBody: DimensionalPriceGroupCreateBody) = - apply { - billableMetricId = dimensionalPriceGroupCreateBody.billableMetricId - dimensions = - dimensionalPriceGroupCreateBody.dimensions.map { it.toMutableList() } - name = dimensionalPriceGroupCreateBody.name - externalDimensionalPriceGroupId = - dimensionalPriceGroupCreateBody.externalDimensionalPriceGroupId - metadata = dimensionalPriceGroupCreateBody.metadata - additionalProperties = - dimensionalPriceGroupCreateBody.additionalProperties.toMutableMap() - } + internal fun from(body: Body) = apply { + billableMetricId = body.billableMetricId + dimensions = body.dimensions.map { it.toMutableList() } + name = body.name + externalDimensionalPriceGroupId = body.externalDimensionalPriceGroupId + metadata = body.metadata + additionalProperties = body.additionalProperties.toMutableMap() + } fun billableMetricId(billableMetricId: String) = billableMetricId(JsonField.of(billableMetricId)) @@ -280,8 +276,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): DimensionalPriceGroupCreateBody = - DimensionalPriceGroupCreateBody( + fun build(): Body = + Body( checkRequired("billableMetricId", billableMetricId), checkRequired("dimensions", dimensions).map { it.toImmutable() }, checkRequired("name", name), @@ -296,7 +292,7 @@ private constructor( return true } - return /* spotless:off */ other is DimensionalPriceGroupCreateBody && billableMetricId == other.billableMetricId && dimensions == other.dimensions && name == other.name && externalDimensionalPriceGroupId == other.externalDimensionalPriceGroupId && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && billableMetricId == other.billableMetricId && dimensions == other.dimensions && name == other.name && externalDimensionalPriceGroupId == other.externalDimensionalPriceGroupId && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -306,7 +302,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "DimensionalPriceGroupCreateBody{billableMetricId=$billableMetricId, dimensions=$dimensions, name=$name, externalDimensionalPriceGroupId=$externalDimensionalPriceGroupId, metadata=$metadata, additionalProperties=$additionalProperties}" + "Body{billableMetricId=$billableMetricId, dimensions=$dimensions, name=$name, externalDimensionalPriceGroupId=$externalDimensionalPriceGroupId, metadata=$metadata, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -320,8 +316,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: DimensionalPriceGroupCreateBody.Builder = - DimensionalPriceGroupCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -523,7 +518,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 be9c5734..027b9077 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 @@ -79,13 +79,8 @@ private constructor( fun of( dimensionalPriceGroupsService: DimensionalPriceGroupService, params: DimensionalPriceGroupListParams, - response: Response - ) = - DimensionalPriceGroupListPage( - dimensionalPriceGroupsService, - params, - response, - ) + response: Response, + ) = DimensionalPriceGroupListPage(dimensionalPriceGroupsService, params, response) } @NoAutoDetect @@ -176,18 +171,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: DimensionalPriceGroupListPage, - ) : Iterable { + class AutoPager(private val firstPage: DimensionalPriceGroupListPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 2bf6263d..ff7d0b73 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 @@ -82,13 +82,8 @@ private constructor( fun of( dimensionalPriceGroupsService: DimensionalPriceGroupServiceAsync, params: DimensionalPriceGroupListParams, - response: Response - ) = - DimensionalPriceGroupListPageAsync( - dimensionalPriceGroupsService, - params, - response, - ) + response: Response, + ) = DimensionalPriceGroupListPageAsync(dimensionalPriceGroupsService, params, response) } @NoAutoDetect @@ -179,26 +174,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: DimensionalPriceGroupListPageAsync, - ) { + class AutoPager(private val firstPage: DimensionalPriceGroupListPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (DimensionalPriceGroup) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -207,7 +195,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Discount.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Discount.kt index f7c37f0a..a8303261 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Discount.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Discount.kt @@ -206,7 +206,7 @@ private constructor( override fun serialize( value: Discount, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.percentage != null -> generator.writeObject(value.percentage) @@ -408,11 +408,8 @@ private constructor( ) } - class DiscountType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class DiscountType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -433,7 +430,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EvaluatePriceGroup.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EvaluatePriceGroup.kt index b3294c5e..4324496d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EvaluatePriceGroup.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EvaluatePriceGroup.kt @@ -313,7 +313,7 @@ private constructor( override fun serialize( value: GroupingValue, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.string != null -> generator.writeObject(value.string) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseResponse.kt index 8147c8d3..1b40022e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseResponse.kt @@ -388,11 +388,7 @@ private constructor( } /** The status of the backfill. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt index b6d6cfe3..a4455eac 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt @@ -53,7 +53,7 @@ import java.util.Optional */ class EventBackfillCreateParams private constructor( - private val body: EventBackfillCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -138,16 +138,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): EventBackfillCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class EventBackfillCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("timeframe_end") @ExcludeMissing private val timeframeEnd: JsonField = JsonMissing.of(), @@ -272,7 +272,7 @@ private constructor( private var validated: Boolean = false - fun validate(): EventBackfillCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -294,7 +294,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [EventBackfillCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var timeframeEnd: JsonField? = null @@ -307,15 +307,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(eventBackfillCreateBody: EventBackfillCreateBody) = apply { - timeframeEnd = eventBackfillCreateBody.timeframeEnd - timeframeStart = eventBackfillCreateBody.timeframeStart - closeTime = eventBackfillCreateBody.closeTime - customerId = eventBackfillCreateBody.customerId - deprecationFilter = eventBackfillCreateBody.deprecationFilter - externalCustomerId = eventBackfillCreateBody.externalCustomerId - replaceExistingEvents = eventBackfillCreateBody.replaceExistingEvents - additionalProperties = eventBackfillCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + timeframeEnd = body.timeframeEnd + timeframeStart = body.timeframeStart + closeTime = body.closeTime + customerId = body.customerId + deprecationFilter = body.deprecationFilter + externalCustomerId = body.externalCustomerId + replaceExistingEvents = body.replaceExistingEvents + additionalProperties = body.additionalProperties.toMutableMap() } /** The (exclusive) end of the usage timeframe affected by this backfill. */ @@ -455,8 +455,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): EventBackfillCreateBody = - EventBackfillCreateBody( + fun build(): Body = + Body( checkRequired("timeframeEnd", timeframeEnd), checkRequired("timeframeStart", timeframeStart), closeTime, @@ -473,7 +473,7 @@ private constructor( return true } - return /* spotless:off */ other is EventBackfillCreateBody && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && closeTime == other.closeTime && customerId == other.customerId && deprecationFilter == other.deprecationFilter && externalCustomerId == other.externalCustomerId && replaceExistingEvents == other.replaceExistingEvents && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && closeTime == other.closeTime && customerId == other.customerId && deprecationFilter == other.deprecationFilter && externalCustomerId == other.externalCustomerId && replaceExistingEvents == other.replaceExistingEvents && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -483,7 +483,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "EventBackfillCreateBody{timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, closeTime=$closeTime, customerId=$customerId, deprecationFilter=$deprecationFilter, externalCustomerId=$externalCustomerId, replaceExistingEvents=$replaceExistingEvents, additionalProperties=$additionalProperties}" + "Body{timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, closeTime=$closeTime, customerId=$customerId, deprecationFilter=$deprecationFilter, externalCustomerId=$externalCustomerId, replaceExistingEvents=$replaceExistingEvents, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -497,7 +497,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: EventBackfillCreateBody.Builder = EventBackfillCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateResponse.kt index 4b8d09cc..b2d2eafc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateResponse.kt @@ -388,11 +388,7 @@ private constructor( } /** The status of the backfill. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchResponse.kt index b2b73259..e8d0fab5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchResponse.kt @@ -388,11 +388,7 @@ private constructor( } /** The status of the backfill. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 70998494..fa384508 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 @@ -86,13 +86,8 @@ private constructor( fun of( backfillsService: BackfillService, params: EventBackfillListParams, - response: Response - ) = - EventBackfillListPage( - backfillsService, - params, - response, - ) + response: Response, + ) = EventBackfillListPage(backfillsService, params, response) } @NoAutoDetect @@ -184,18 +179,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: EventBackfillListPage, - ) : Iterable { + class AutoPager(private val firstPage: EventBackfillListPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 5877ad90..f7cdd876 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 @@ -89,13 +89,8 @@ private constructor( fun of( backfillsService: BackfillServiceAsync, params: EventBackfillListParams, - response: Response - ) = - EventBackfillListPageAsync( - backfillsService, - params, - response, - ) + response: Response, + ) = EventBackfillListPageAsync(backfillsService, params, response) } @NoAutoDetect @@ -187,26 +182,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: EventBackfillListPageAsync, - ) { + class AutoPager(private val firstPage: EventBackfillListPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (EventBackfillListResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -215,7 +203,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListResponse.kt index accc455f..6bc6c395 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListResponse.kt @@ -388,11 +388,7 @@ private constructor( } /** The status of the backfill. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertResponse.kt index a5621aeb..fa8cd446 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertResponse.kt @@ -388,11 +388,7 @@ private constructor( } /** The status of the backfill. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateResponse.kt index 8082a7d3..e90fb17a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateResponse.kt @@ -94,7 +94,7 @@ private constructor( fun build(): EventDeprecateResponse = EventDeprecateResponse( checkRequired("deprecated", deprecated), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt index b81d885a..b3c90e43 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt @@ -211,7 +211,7 @@ class EventIngestParams private constructor( private val backfillId: String?, private val debug: Boolean?, - private val body: EventIngestBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -235,7 +235,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): EventIngestBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -248,9 +248,9 @@ private constructor( } @NoAutoDetect - class EventIngestBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("events") @ExcludeMissing private val events: JsonField> = JsonMissing.of(), @@ -268,7 +268,7 @@ private constructor( private var validated: Boolean = false - fun validate(): EventIngestBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -284,16 +284,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [EventIngestBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var events: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(eventIngestBody: EventIngestBody) = apply { - events = eventIngestBody.events.map { it.toMutableList() } - additionalProperties = eventIngestBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + events = body.events.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() } fun events(events: List) = events(JsonField.of(events)) @@ -334,10 +334,10 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): EventIngestBody = - EventIngestBody( + fun build(): Body = + Body( checkRequired("events", events).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -346,7 +346,7 @@ private constructor( return true } - return /* spotless:off */ other is EventIngestBody && events == other.events && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && events == other.events && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -355,8 +355,7 @@ private constructor( override fun hashCode(): Int = hashCode - override fun toString() = - "EventIngestBody{events=$events, additionalProperties=$additionalProperties}" + override fun toString() = "Body{events=$events, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -372,7 +371,7 @@ private constructor( private var backfillId: String? = null private var debug: Boolean? = null - private var body: EventIngestBody.Builder = EventIngestBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt index e84fc591..9cc3f022 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt @@ -37,7 +37,7 @@ import java.util.Optional */ class EventSearchParams private constructor( - private val body: EventSearchBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -86,16 +86,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): EventSearchBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class EventSearchBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("event_ids") @ExcludeMissing private val eventIds: JsonField> = JsonMissing.of(), @@ -161,7 +161,7 @@ private constructor( private var validated: Boolean = false - fun validate(): EventSearchBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -179,7 +179,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [EventSearchBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var eventIds: JsonField>? = null @@ -188,11 +188,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(eventSearchBody: EventSearchBody) = apply { - eventIds = eventSearchBody.eventIds.map { it.toMutableList() } - timeframeEnd = eventSearchBody.timeframeEnd - timeframeStart = eventSearchBody.timeframeStart - additionalProperties = eventSearchBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + eventIds = body.eventIds.map { it.toMutableList() } + timeframeEnd = body.timeframeEnd + timeframeStart = body.timeframeStart + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -292,8 +292,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): EventSearchBody = - EventSearchBody( + fun build(): Body = + Body( checkRequired("eventIds", eventIds).map { it.toImmutable() }, timeframeEnd, timeframeStart, @@ -306,7 +306,7 @@ private constructor( return true } - return /* spotless:off */ other is EventSearchBody && eventIds == other.eventIds && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && eventIds == other.eventIds && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -316,7 +316,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "EventSearchBody{eventIds=$eventIds, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, additionalProperties=$additionalProperties}" + "Body{eventIds=$eventIds, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -330,7 +330,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: EventSearchBody.Builder = EventSearchBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchResponse.kt index ce219983..130082ff 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchResponse.kt @@ -107,7 +107,7 @@ private constructor( fun build(): EventSearchResponse = EventSearchResponse( checkRequired("data", data).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } 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 511c070b..b731a8a3 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 @@ -63,7 +63,7 @@ import java.util.Optional class EventUpdateParams private constructor( private val eventId: String, - private val body: EventUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -114,7 +114,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): EventUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -128,9 +128,9 @@ private constructor( } @NoAutoDetect - class EventUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("event_name") @ExcludeMissing private val eventName: JsonField = JsonMissing.of(), @@ -202,7 +202,7 @@ private constructor( private var validated: Boolean = false - fun validate(): EventUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -221,7 +221,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [EventUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var eventName: JsonField? = null @@ -232,13 +232,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(eventUpdateBody: EventUpdateBody) = apply { - eventName = eventUpdateBody.eventName - properties = eventUpdateBody.properties - timestamp = eventUpdateBody.timestamp - customerId = eventUpdateBody.customerId - externalCustomerId = eventUpdateBody.externalCustomerId - additionalProperties = eventUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + eventName = body.eventName + properties = body.properties + timestamp = body.timestamp + customerId = body.customerId + externalCustomerId = body.externalCustomerId + additionalProperties = body.additionalProperties.toMutableMap() } /** A name to meaningfully identify the action or event type. */ @@ -316,8 +316,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): EventUpdateBody = - EventUpdateBody( + fun build(): Body = + Body( checkRequired("eventName", eventName), checkRequired("properties", properties), checkRequired("timestamp", timestamp), @@ -332,7 +332,7 @@ private constructor( return true } - return /* spotless:off */ other is EventUpdateBody && eventName == other.eventName && properties == other.properties && timestamp == other.timestamp && customerId == other.customerId && externalCustomerId == other.externalCustomerId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && eventName == other.eventName && properties == other.properties && timestamp == other.timestamp && customerId == other.customerId && externalCustomerId == other.externalCustomerId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -342,7 +342,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "EventUpdateBody{eventName=$eventName, properties=$properties, timestamp=$timestamp, customerId=$customerId, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" + "Body{eventName=$eventName, properties=$properties, timestamp=$timestamp, customerId=$customerId, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -357,7 +357,7 @@ private constructor( class Builder internal constructor() { private var eventId: String? = null - private var body: EventUpdateBody.Builder = EventUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateResponse.kt index 095f4ebb..59fea7c7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateResponse.kt @@ -94,7 +94,7 @@ private constructor( fun build(): EventUpdateResponse = EventUpdateResponse( checkRequired("amended", amended), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt index c903c37f..13b869b1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt @@ -70,7 +70,7 @@ private constructor( this.timeframeStart.let { queryParams.put( "timeframe_start", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) } @@ -78,7 +78,7 @@ private constructor( this.timeframeEnd?.let { queryParams.put( "timeframe_end", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } queryParams.putAll(additionalQueryParams) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumes.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumes.kt index 7d88039e..80ead470 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumes.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumes.kt @@ -106,7 +106,7 @@ private constructor( fun build(): EventVolumes = EventVolumes( checkRequired("data", data).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } 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 0268bd10..88880d35 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 @@ -2915,11 +2915,7 @@ private constructor( ) } - class Action - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Action @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3253,11 +3249,7 @@ private constructor( "InnerInvoice{id=$id, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3576,11 +3568,8 @@ private constructor( ) } - class Country - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Country @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4126,11 +4115,7 @@ private constructor( override fun toString() = value.toString() } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4650,11 +4635,8 @@ private constructor( "CustomerTaxId{country=$country, type=$type, value=$value, additionalProperties=$additionalProperties}" } - class InvoiceSource - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class InvoiceSource @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6132,7 +6114,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -6143,7 +6125,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -6154,7 +6136,7 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -6189,7 +6171,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.monetaryUsageDiscount != null -> @@ -6472,9 +6454,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -6496,7 +6476,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -6844,9 +6824,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -6868,7 +6846,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -7217,9 +7195,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -7241,7 +7217,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -7607,9 +7583,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -7631,7 +7605,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -7978,9 +7952,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -8002,7 +7974,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -8582,7 +8554,7 @@ private constructor( override fun serialize( value: SubLineItem, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.matrix != null -> generator.writeObject(value.matrix) @@ -8996,7 +8968,7 @@ private constructor( checkRequired("dimensionValues", dimensionValues).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -9018,11 +8990,8 @@ private constructor( "MatrixConfig{dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -9044,7 +9013,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - MATRIX, + MATRIX } /** @@ -9573,11 +9542,8 @@ private constructor( "TierConfig{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -9599,7 +9565,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - TIER, + TIER } /** @@ -9957,11 +9923,8 @@ private constructor( "Grouping{key=$key, value=$value, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -9983,7 +9946,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - NULL, + NULL } /** @@ -10411,7 +10374,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -10846,9 +10809,7 @@ private constructor( /** The payment provider that attempted to collect the payment. */ class PaymentProvider @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -10869,7 +10830,7 @@ private constructor( /** An enum containing [PaymentProvider]'s known values. */ enum class Known { - STRIPE, + STRIPE } /** @@ -11138,11 +11099,7 @@ private constructor( "ShippingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt index c727016d..5a71231d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt @@ -27,7 +27,7 @@ import java.util.Optional /** This endpoint is used to create a one-off invoice for a customer. */ class InvoiceCreateParams private constructor( - private val body: InvoiceCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -136,16 +136,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): InvoiceCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class InvoiceCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -301,7 +301,7 @@ private constructor( private var validated: Boolean = false - fun validate(): InvoiceCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -326,7 +326,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InvoiceCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var currency: JsonField? = null @@ -342,18 +342,18 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(invoiceCreateBody: InvoiceCreateBody) = apply { - currency = invoiceCreateBody.currency - invoiceDate = invoiceCreateBody.invoiceDate - lineItems = invoiceCreateBody.lineItems.map { it.toMutableList() } - netTerms = invoiceCreateBody.netTerms - customerId = invoiceCreateBody.customerId - discount = invoiceCreateBody.discount - externalCustomerId = invoiceCreateBody.externalCustomerId - memo = invoiceCreateBody.memo - metadata = invoiceCreateBody.metadata - willAutoIssue = invoiceCreateBody.willAutoIssue - additionalProperties = invoiceCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + currency = body.currency + invoiceDate = body.invoiceDate + lineItems = body.lineItems.map { it.toMutableList() } + netTerms = body.netTerms + customerId = body.customerId + discount = body.discount + externalCustomerId = body.externalCustomerId + memo = body.memo + metadata = body.metadata + willAutoIssue = body.willAutoIssue + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -551,8 +551,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InvoiceCreateBody = - InvoiceCreateBody( + fun build(): Body = + Body( checkRequired("currency", currency), checkRequired("invoiceDate", invoiceDate), checkRequired("lineItems", lineItems).map { it.toImmutable() }, @@ -572,7 +572,7 @@ private constructor( return true } - return /* spotless:off */ other is InvoiceCreateBody && currency == other.currency && invoiceDate == other.invoiceDate && lineItems == other.lineItems && netTerms == other.netTerms && customerId == other.customerId && discount == other.discount && externalCustomerId == other.externalCustomerId && memo == other.memo && metadata == other.metadata && willAutoIssue == other.willAutoIssue && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && currency == other.currency && invoiceDate == other.invoiceDate && lineItems == other.lineItems && netTerms == other.netTerms && customerId == other.customerId && discount == other.discount && externalCustomerId == other.externalCustomerId && memo == other.memo && metadata == other.metadata && willAutoIssue == other.willAutoIssue && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -582,7 +582,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InvoiceCreateBody{currency=$currency, invoiceDate=$invoiceDate, lineItems=$lineItems, netTerms=$netTerms, customerId=$customerId, discount=$discount, externalCustomerId=$externalCustomerId, memo=$memo, metadata=$metadata, willAutoIssue=$willAutoIssue, additionalProperties=$additionalProperties}" + "Body{currency=$currency, invoiceDate=$invoiceDate, lineItems=$lineItems, netTerms=$netTerms, customerId=$customerId, discount=$discount, externalCustomerId=$externalCustomerId, memo=$memo, metadata=$metadata, willAutoIssue=$willAutoIssue, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -596,7 +596,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: InvoiceCreateBody.Builder = InvoiceCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -1080,11 +1080,8 @@ private constructor( ) } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1105,7 +1102,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT, + UNIT } /** @@ -1255,7 +1252,7 @@ private constructor( fun build(): UnitConfig = UnitConfig( checkRequired("unitAmount", unitAmount), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -1305,7 +1302,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 a02e73b5..da554e38 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 @@ -2909,11 +2909,7 @@ private constructor( ) } - class Action - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Action @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3246,11 +3242,7 @@ private constructor( override fun toString() = "Invoice{id=$id, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3569,11 +3561,8 @@ private constructor( ) } - class Country - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Country @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4119,11 +4108,7 @@ private constructor( override fun toString() = value.toString() } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4643,11 +4628,8 @@ private constructor( "CustomerTaxId{country=$country, type=$type, value=$value, additionalProperties=$additionalProperties}" } - class InvoiceSource - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class InvoiceSource @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6125,7 +6107,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -6136,7 +6118,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -6147,7 +6129,7 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -6182,7 +6164,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.monetaryUsageDiscount != null -> @@ -6465,9 +6447,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -6489,7 +6469,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -6837,9 +6817,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -6861,7 +6839,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -7210,9 +7188,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -7234,7 +7210,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -7600,9 +7576,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -7624,7 +7598,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -7971,9 +7945,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -7995,7 +7967,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -8575,7 +8547,7 @@ private constructor( override fun serialize( value: SubLineItem, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.matrix != null -> generator.writeObject(value.matrix) @@ -8989,7 +8961,7 @@ private constructor( checkRequired("dimensionValues", dimensionValues).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -9011,11 +8983,8 @@ private constructor( "MatrixConfig{dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -9037,7 +9006,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - MATRIX, + MATRIX } /** @@ -9566,11 +9535,8 @@ private constructor( "TierConfig{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -9592,7 +9558,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - TIER, + TIER } /** @@ -9950,11 +9916,8 @@ private constructor( "Grouping{key=$key, value=$value, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -9976,7 +9939,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - NULL, + NULL } /** @@ -10404,7 +10367,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -10839,9 +10802,7 @@ private constructor( /** The payment provider that attempted to collect the payment. */ class PaymentProvider @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -10862,7 +10823,7 @@ private constructor( /** An enum containing [PaymentProvider]'s known values. */ enum class Known { - STRIPE, + STRIPE } /** @@ -11131,11 +11092,7 @@ private constructor( "ShippingAddress{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 6b1a1f77..1339a02a 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 @@ -30,7 +30,7 @@ import java.util.Optional class InvoiceIssueParams private constructor( private val invoiceId: String, - private val body: InvoiceIssueBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -59,7 +59,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): InvoiceIssueBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -73,9 +73,9 @@ private constructor( } @NoAutoDetect - class InvoiceIssueBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("synchronous") @ExcludeMissing private val synchronous: JsonField = JsonMissing.of(), @@ -108,7 +108,7 @@ private constructor( private var validated: Boolean = false - fun validate(): InvoiceIssueBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -124,16 +124,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InvoiceIssueBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var synchronous: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(invoiceIssueBody: InvoiceIssueBody) = apply { - synchronous = invoiceIssueBody.synchronous - additionalProperties = invoiceIssueBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + synchronous = body.synchronous + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -175,8 +175,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InvoiceIssueBody = - InvoiceIssueBody(synchronous, additionalProperties.toImmutable()) + fun build(): Body = Body(synchronous, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -184,7 +183,7 @@ private constructor( return true } - return /* spotless:off */ other is InvoiceIssueBody && synchronous == other.synchronous && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && synchronous == other.synchronous && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -194,7 +193,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InvoiceIssueBody{synchronous=$synchronous, additionalProperties=$additionalProperties}" + "Body{synchronous=$synchronous, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -209,7 +208,7 @@ private constructor( class Builder internal constructor() { private var invoiceId: String? = null - private var body: InvoiceIssueBody.Builder = InvoiceIssueBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLevelDiscount.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLevelDiscount.kt index 79bf10f9..023e08f8 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLevelDiscount.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLevelDiscount.kt @@ -177,7 +177,7 @@ private constructor( override fun serialize( value: InvoiceLevelDiscount, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.percentage != null -> generator.writeObject(value.percentage) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt index 25ed1d55..eec71cd2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt @@ -26,7 +26,7 @@ import java.util.Objects */ class InvoiceLineItemCreateParams private constructor( - private val body: InvoiceLineItemCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -79,16 +79,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): InvoiceLineItemCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class InvoiceLineItemCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), @@ -161,7 +161,7 @@ private constructor( private var validated: Boolean = false - fun validate(): InvoiceLineItemCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -182,7 +182,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InvoiceLineItemCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var amount: JsonField? = null @@ -194,14 +194,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(invoiceLineItemCreateBody: InvoiceLineItemCreateBody) = apply { - amount = invoiceLineItemCreateBody.amount - endDate = invoiceLineItemCreateBody.endDate - invoiceId = invoiceLineItemCreateBody.invoiceId - name = invoiceLineItemCreateBody.name - quantity = invoiceLineItemCreateBody.quantity - startDate = invoiceLineItemCreateBody.startDate - additionalProperties = invoiceLineItemCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + amount = body.amount + endDate = body.endDate + invoiceId = body.invoiceId + name = body.name + quantity = body.quantity + startDate = body.startDate + additionalProperties = body.additionalProperties.toMutableMap() } /** The total amount in the invoice's currency to add to the line item. */ @@ -265,8 +265,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InvoiceLineItemCreateBody = - InvoiceLineItemCreateBody( + fun build(): Body = + Body( checkRequired("amount", amount), checkRequired("endDate", endDate), checkRequired("invoiceId", invoiceId), @@ -282,7 +282,7 @@ private constructor( return true } - return /* spotless:off */ other is InvoiceLineItemCreateBody && amount == other.amount && endDate == other.endDate && invoiceId == other.invoiceId && name == other.name && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && amount == other.amount && endDate == other.endDate && invoiceId == other.invoiceId && name == other.name && quantity == other.quantity && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -292,7 +292,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InvoiceLineItemCreateBody{amount=$amount, endDate=$endDate, invoiceId=$invoiceId, name=$name, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" + "Body{amount=$amount, endDate=$endDate, invoiceId=$invoiceId, name=$name, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -306,7 +306,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: InvoiceLineItemCreateBody.Builder = InvoiceLineItemCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() 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 ad6f17a8..2f1ecadb 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 @@ -1408,7 +1408,7 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1443,7 +1443,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.monetaryUsageDiscount != null -> @@ -1722,9 +1722,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1745,7 +1743,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -2093,9 +2091,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2116,7 +2112,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2464,9 +2460,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2487,7 +2481,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2850,9 +2844,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2873,7 +2865,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3217,9 +3209,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3240,7 +3230,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3802,7 +3792,7 @@ private constructor( override fun serialize( value: SubLineItem, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.matrix != null -> generator.writeObject(value.matrix) @@ -4211,7 +4201,7 @@ private constructor( checkRequired("dimensionValues", dimensionValues).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -4233,11 +4223,8 @@ private constructor( "MatrixConfig{dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4258,7 +4245,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - MATRIX, + MATRIX } /** @@ -4778,11 +4765,8 @@ private constructor( "TierConfig{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4803,7 +4787,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - TIER, + TIER } /** @@ -5157,11 +5141,8 @@ private constructor( "Grouping{key=$key, value=$value, additionalProperties=$additionalProperties}" } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5182,7 +5163,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - NULL, + NULL } /** 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 af3b4778..de9caa31 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 @@ -90,11 +90,7 @@ private constructor( @JvmStatic fun of(invoicesService: InvoiceService, params: InvoiceListParams, response: Response) = - InvoiceListPage( - invoicesService, - params, - response, - ) + InvoiceListPage(invoicesService, params, response) } @NoAutoDetect @@ -184,18 +180,11 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: InvoiceListPage, - ) : Iterable { + class AutoPager(private val firstPage: InvoiceListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 2ccfd686..2d5aa7f0 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 @@ -95,13 +95,8 @@ private constructor( fun of( invoicesService: InvoiceServiceAsync, params: InvoiceListParams, - response: Response - ) = - InvoiceListPageAsync( - invoicesService, - params, - response, - ) + response: Response, + ) = InvoiceListPageAsync(invoicesService, params, response) } @NoAutoDetect @@ -191,23 +186,16 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: InvoiceListPageAsync, - ) { + class AutoPager(private val firstPage: InvoiceListPageAsync) { fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( action: (Invoice) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -216,7 +204,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt index d3e1944e..7c523675 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt @@ -128,25 +128,25 @@ private constructor( this.invoiceDateGt?.let { queryParams.put( "invoice_date[gt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.invoiceDateGte?.let { queryParams.put( "invoice_date[gte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.invoiceDateLt?.let { queryParams.put( "invoice_date[lt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.invoiceDateLte?.let { queryParams.put( "invoice_date[lte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.isRecurring?.let { queryParams.put("is_recurring", listOf(it.toString())) } @@ -464,11 +464,7 @@ private constructor( ) } - class DateType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class DateType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -555,11 +551,7 @@ private constructor( override fun toString() = value.toString() } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 d688b6fa..bd64219a 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 @@ -28,7 +28,7 @@ import java.util.Optional class InvoiceMarkPaidParams private constructor( private val invoiceId: String, - private val body: InvoiceMarkPaidBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -59,7 +59,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): InvoiceMarkPaidBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -73,9 +73,9 @@ private constructor( } @NoAutoDetect - class InvoiceMarkPaidBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("payment_received_date") @ExcludeMissing private val paymentReceivedDate: JsonField = JsonMissing.of(), @@ -119,7 +119,7 @@ private constructor( private var validated: Boolean = false - fun validate(): InvoiceMarkPaidBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -137,7 +137,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InvoiceMarkPaidBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var paymentReceivedDate: JsonField? = null @@ -146,11 +146,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(invoiceMarkPaidBody: InvoiceMarkPaidBody) = apply { - paymentReceivedDate = invoiceMarkPaidBody.paymentReceivedDate - externalId = invoiceMarkPaidBody.externalId - notes = invoiceMarkPaidBody.notes - additionalProperties = invoiceMarkPaidBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + paymentReceivedDate = body.paymentReceivedDate + externalId = body.externalId + notes = body.notes + additionalProperties = body.additionalProperties.toMutableMap() } /** A date string to specify the date of the payment. */ @@ -199,8 +199,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InvoiceMarkPaidBody = - InvoiceMarkPaidBody( + fun build(): Body = + Body( checkRequired("paymentReceivedDate", paymentReceivedDate), externalId, notes, @@ -213,7 +213,7 @@ private constructor( return true } - return /* spotless:off */ other is InvoiceMarkPaidBody && paymentReceivedDate == other.paymentReceivedDate && externalId == other.externalId && notes == other.notes && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && paymentReceivedDate == other.paymentReceivedDate && externalId == other.externalId && notes == other.notes && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -223,7 +223,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InvoiceMarkPaidBody{paymentReceivedDate=$paymentReceivedDate, externalId=$externalId, notes=$notes, additionalProperties=$additionalProperties}" + "Body{paymentReceivedDate=$paymentReceivedDate, externalId=$externalId, notes=$notes, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -238,7 +238,7 @@ private constructor( class Builder internal constructor() { private var invoiceId: String? = null - private var body: InvoiceMarkPaidBody.Builder = InvoiceMarkPaidBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() 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 f792e307..579eaa15 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 @@ -29,7 +29,7 @@ import java.util.Optional class InvoiceUpdateParams private constructor( private val invoiceId: String, - private val body: InvoiceUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -56,7 +56,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): InvoiceUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -70,9 +70,9 @@ private constructor( } @NoAutoDetect - class InvoiceUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("metadata") @ExcludeMissing private val metadata: JsonField = JsonMissing.of(), @@ -100,7 +100,7 @@ private constructor( private var validated: Boolean = false - fun validate(): InvoiceUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -116,16 +116,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [InvoiceUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(invoiceUpdateBody: InvoiceUpdateBody) = apply { - metadata = invoiceUpdateBody.metadata - additionalProperties = invoiceUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + metadata = body.metadata + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -168,8 +168,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InvoiceUpdateBody = - InvoiceUpdateBody(metadata, additionalProperties.toImmutable()) + fun build(): Body = Body(metadata, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -177,7 +176,7 @@ private constructor( return true } - return /* spotless:off */ other is InvoiceUpdateBody && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -187,7 +186,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InvoiceUpdateBody{metadata=$metadata, additionalProperties=$additionalProperties}" + "Body{metadata=$metadata, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -202,7 +201,7 @@ private constructor( class Builder internal constructor() { private var invoiceId: String? = null - private var body: InvoiceUpdateBody.Builder = InvoiceUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -373,7 +372,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Item.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Item.kt index 30b71168..f18a3297 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Item.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Item.kt @@ -272,9 +272,7 @@ private constructor( class ExternalConnectionName @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt index 64b30fef..f8cfdcf7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt @@ -22,7 +22,7 @@ import java.util.Objects /** This endpoint is used to create an [Item](/core-concepts#item). */ class ItemCreateParams private constructor( - private val body: ItemCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -39,16 +39,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): ItemCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class ItemCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), @@ -68,7 +68,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ItemCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -84,16 +84,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ItemCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var name: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(itemCreateBody: ItemCreateBody) = apply { - name = itemCreateBody.name - additionalProperties = itemCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + name = body.name + additionalProperties = body.additionalProperties.toMutableMap() } /** The name of the item. */ @@ -121,8 +121,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): ItemCreateBody = - ItemCreateBody(checkRequired("name", name), additionalProperties.toImmutable()) + fun build(): Body = + Body(checkRequired("name", name), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -130,7 +130,7 @@ private constructor( return true } - return /* spotless:off */ other is ItemCreateBody && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -139,8 +139,7 @@ private constructor( override fun hashCode(): Int = hashCode - override fun toString() = - "ItemCreateBody{name=$name, additionalProperties=$additionalProperties}" + override fun toString() = "Body{name=$name, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -154,7 +153,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: ItemCreateBody.Builder = ItemCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -289,11 +288,7 @@ private constructor( } fun build(): ItemCreateParams = - ItemCreateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + ItemCreateParams(body.build(), additionalHeaders.build(), additionalQueryParams.build()) } override fun equals(other: Any?): Boolean { 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 54f26e64..ba8aaf7c 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 @@ -77,11 +77,7 @@ private constructor( @JvmStatic fun of(itemsService: ItemService, params: ItemListParams, response: Response) = - ItemListPage( - itemsService, - params, - response, - ) + ItemListPage(itemsService, params, response) } @NoAutoDetect @@ -171,18 +167,11 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: ItemListPage, - ) : Iterable { + class AutoPager(private val firstPage: ItemListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 152272c2..fd6308b4 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 @@ -80,11 +80,7 @@ private constructor( @JvmStatic fun of(itemsService: ItemServiceAsync, params: ItemListParams, response: Response) = - ItemListPageAsync( - itemsService, - params, - response, - ) + ItemListPageAsync(itemsService, params, response) } @NoAutoDetect @@ -174,23 +170,16 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: ItemListPageAsync, - ) { + class AutoPager(private val firstPage: ItemListPageAsync) { fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( action: (Item) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -199,7 +188,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt index fc997715..6d0eece6 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt @@ -186,12 +186,7 @@ private constructor( } fun build(): ItemListParams = - ItemListParams( - cursor, - limit, - additionalHeaders.build(), - additionalQueryParams.build(), - ) + ItemListParams(cursor, limit, additionalHeaders.build(), additionalQueryParams.build()) } override fun equals(other: Any?): Boolean { 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 8d66d5d5..858de5cd 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,7 +26,7 @@ import java.util.Optional class ItemUpdateParams private constructor( private val itemId: String, - private val body: ItemUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -47,7 +47,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): ItemUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -66,9 +66,9 @@ private constructor( * replace the existing item mappings. */ @NoAutoDetect - class ItemUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("external_connections") @ExcludeMissing private val externalConnections: JsonField> = JsonMissing.of(), @@ -96,7 +96,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ItemUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -113,7 +113,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ItemUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var externalConnections: JsonField>? = null @@ -121,10 +121,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(itemUpdateBody: ItemUpdateBody) = apply { - externalConnections = itemUpdateBody.externalConnections.map { it.toMutableList() } - name = itemUpdateBody.name - additionalProperties = itemUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + externalConnections = body.externalConnections.map { it.toMutableList() } + name = body.name + additionalProperties = body.additionalProperties.toMutableMap() } fun externalConnections(externalConnections: List?) = @@ -176,8 +176,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): ItemUpdateBody = - ItemUpdateBody( + fun build(): Body = + Body( (externalConnections ?: JsonMissing.of()).map { it.toImmutable() }, name, additionalProperties.toImmutable(), @@ -189,7 +189,7 @@ private constructor( return true } - return /* spotless:off */ other is ItemUpdateBody && externalConnections == other.externalConnections && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && externalConnections == other.externalConnections && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -199,7 +199,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ItemUpdateBody{externalConnections=$externalConnections, name=$name, additionalProperties=$additionalProperties}" + "Body{externalConnections=$externalConnections, name=$name, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -214,7 +214,7 @@ private constructor( class Builder internal constructor() { private var itemId: String? = null - private var body: ItemUpdateBody.Builder = ItemUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -483,9 +483,7 @@ private constructor( class ExternalConnectionName @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt index daf97f25..57de8d22 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt @@ -27,7 +27,7 @@ import java.util.Optional */ class MetricCreateParams private constructor( - private val body: MetricCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -76,16 +76,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): MetricCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class MetricCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), @@ -150,7 +150,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MetricCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -170,7 +170,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MetricCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var description: JsonField? = null @@ -181,13 +181,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(metricCreateBody: MetricCreateBody) = apply { - description = metricCreateBody.description - itemId = metricCreateBody.itemId - name = metricCreateBody.name - sql = metricCreateBody.sql - metadata = metricCreateBody.metadata - additionalProperties = metricCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + description = body.description + itemId = body.itemId + name = body.name + sql = body.sql + metadata = body.metadata + additionalProperties = body.additionalProperties.toMutableMap() } /** A description of the metric. */ @@ -259,8 +259,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): MetricCreateBody = - MetricCreateBody( + fun build(): Body = + Body( checkRequired("description", description), checkRequired("itemId", itemId), checkRequired("name", name), @@ -275,7 +275,7 @@ private constructor( return true } - return /* spotless:off */ other is MetricCreateBody && description == other.description && itemId == other.itemId && name == other.name && sql == other.sql && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && description == other.description && itemId == other.itemId && name == other.name && sql == other.sql && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -285,7 +285,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MetricCreateBody{description=$description, itemId=$itemId, name=$name, sql=$sql, metadata=$metadata, additionalProperties=$additionalProperties}" + "Body{description=$description, itemId=$itemId, name=$name, sql=$sql, metadata=$metadata, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -299,7 +299,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: MetricCreateBody.Builder = MetricCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -493,7 +493,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 81c0c83e..2ab86028 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 @@ -80,11 +80,7 @@ private constructor( @JvmStatic fun of(metricsService: MetricService, params: MetricListParams, response: Response) = - MetricListPage( - metricsService, - params, - response, - ) + MetricListPage(metricsService, params, response) } @NoAutoDetect @@ -174,18 +170,11 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: MetricListPage, - ) : Iterable { + class AutoPager(private val firstPage: MetricListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 f0cc24fe..723eced5 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 @@ -83,11 +83,7 @@ private constructor( @JvmStatic fun of(metricsService: MetricServiceAsync, params: MetricListParams, response: Response) = - MetricListPageAsync( - metricsService, - params, - response, - ) + MetricListPageAsync(metricsService, params, response) } @NoAutoDetect @@ -177,26 +173,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: MetricListPageAsync, - ) { + class AutoPager(private val firstPage: MetricListPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (BillableMetric) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -205,7 +194,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt index 85e7291d..f97dd44d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt @@ -55,25 +55,25 @@ private constructor( this.createdAtGt?.let { queryParams.put( "created_at[gt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtGte?.let { queryParams.put( "created_at[gte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLt?.let { queryParams.put( "created_at[lt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLte?.let { queryParams.put( "created_at[lte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) } 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 a5b29388..0c5bed30 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 @@ -27,7 +27,7 @@ import java.util.Optional class MetricUpdateParams private constructor( private val metricId: String, - private val body: MetricUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -54,7 +54,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): MetricUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -68,9 +68,9 @@ private constructor( } @NoAutoDetect - class MetricUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("metadata") @ExcludeMissing private val metadata: JsonField = JsonMissing.of(), @@ -98,7 +98,7 @@ private constructor( private var validated: Boolean = false - fun validate(): MetricUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -114,16 +114,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MetricUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(metricUpdateBody: MetricUpdateBody) = apply { - metadata = metricUpdateBody.metadata - additionalProperties = metricUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + metadata = body.metadata + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -166,8 +166,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): MetricUpdateBody = - MetricUpdateBody(metadata, additionalProperties.toImmutable()) + fun build(): Body = Body(metadata, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -175,7 +174,7 @@ private constructor( return true } - return /* spotless:off */ other is MetricUpdateBody && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -185,7 +184,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MetricUpdateBody{metadata=$metadata, additionalProperties=$additionalProperties}" + "Body{metadata=$metadata, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -200,7 +199,7 @@ private constructor( class Builder internal constructor() { private var metricId: String? = null - private var body: MetricUpdateBody.Builder = MetricUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -371,7 +370,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PercentageDiscount.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PercentageDiscount.kt index c9342abd..90f196f9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PercentageDiscount.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PercentageDiscount.kt @@ -195,11 +195,8 @@ private constructor( ) } - class DiscountType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class DiscountType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -220,7 +217,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** 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 9495066e..a28cf524 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 @@ -1220,7 +1220,7 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1255,7 +1255,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.planPhaseUsageDiscount != null -> @@ -1550,9 +1550,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1573,7 +1571,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -1935,9 +1933,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1958,7 +1954,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2320,9 +2316,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2343,7 +2337,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2720,9 +2714,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2743,7 +2735,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3101,9 +3093,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3124,7 +3114,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3541,7 +3531,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -4090,11 +4080,8 @@ private constructor( ) } - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class DurationUnit @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4680,11 +4667,7 @@ private constructor( "Product{id=$id, createdAt=$createdAt, name=$name, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4887,9 +4870,7 @@ private constructor( class TrialPeriodUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4910,7 +4891,7 @@ private constructor( /** An enum containing [TrialPeriodUnit]'s known values. */ enum class Known { - DAYS, + DAYS } /** 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 8850e7b6..0b2285f1 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 @@ -36,7 +36,7 @@ import kotlin.jvm.optionals.getOrNull /** This endpoint allows creation of plans including their prices. */ class PlanCreateParams private constructor( - private val body: PlanCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -117,16 +117,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): PlanCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class PlanCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -237,7 +237,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -260,7 +260,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var currency: JsonField? = null @@ -274,16 +274,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planCreateBody: PlanCreateBody) = apply { - currency = planCreateBody.currency - name = planCreateBody.name - prices = planCreateBody.prices.map { it.toMutableList() } - defaultInvoiceMemo = planCreateBody.defaultInvoiceMemo - externalPlanId = planCreateBody.externalPlanId - metadata = planCreateBody.metadata - netTerms = planCreateBody.netTerms - status = planCreateBody.status - additionalProperties = planCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + currency = body.currency + name = body.name + prices = body.prices.map { it.toMutableList() } + defaultInvoiceMemo = body.defaultInvoiceMemo + externalPlanId = body.externalPlanId + metadata = body.metadata + netTerms = body.netTerms + status = body.status + additionalProperties = body.additionalProperties.toMutableMap() } /** An ISO 4217 currency string for invoices generated by subscriptions on this plan. */ @@ -621,8 +621,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): PlanCreateBody = - PlanCreateBody( + fun build(): Body = + Body( checkRequired("currency", currency), checkRequired("name", name), checkRequired("prices", prices).map { it.toImmutable() }, @@ -640,7 +640,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanCreateBody && currency == other.currency && name == other.name && prices == other.prices && defaultInvoiceMemo == other.defaultInvoiceMemo && externalPlanId == other.externalPlanId && metadata == other.metadata && netTerms == other.netTerms && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && currency == other.currency && name == other.name && prices == other.prices && defaultInvoiceMemo == other.defaultInvoiceMemo && externalPlanId == other.externalPlanId && metadata == other.metadata && netTerms == other.netTerms && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -650,7 +650,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanCreateBody{currency=$currency, name=$name, prices=$prices, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, metadata=$metadata, netTerms=$netTerms, status=$status, additionalProperties=$additionalProperties}" + "Body{currency=$currency, name=$name, prices=$prices, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, metadata=$metadata, netTerms=$netTerms, status=$status, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -664,7 +664,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: PlanCreateBody.Builder = PlanCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -1101,11 +1101,7 @@ private constructor( } fun build(): PlanCreateParams = - PlanCreateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) + PlanCreateParams(body.build(), additionalHeaders.build(), additionalQueryParams.build()) } @JsonDeserialize(using = Price.Deserializer::class) @@ -1946,7 +1942,7 @@ private constructor( "grouped_with_prorated_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1957,7 +1953,7 @@ private constructor( "grouped_with_metered_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -2000,28 +1996,28 @@ private constructor( "scalable_matrix_with_unit_pricing" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newPlanScalableMatrixWithUnitPricing = it, - _json = json + _json = json, ) } } "scalable_matrix_with_tiered_pricing" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newPlanScalableMatrixWithTieredPricing = it, - _json = json + _json = json, ) } } @@ -2044,7 +2040,7 @@ private constructor( override fun serialize( value: Price, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newPlanUnit != null -> generator.writeObject(value.newPlanUnit) @@ -2676,11 +2672,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2795,11 +2788,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2820,7 +2810,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT, + UNIT } /** @@ -2970,7 +2960,7 @@ private constructor( fun build(): UnitConfig = UnitConfig( checkRequired("unitAmount", unitAmount), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -3112,9 +3102,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3347,9 +3335,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3471,7 +3457,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -4147,11 +4133,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4266,11 +4249,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4291,7 +4271,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE, + PACKAGE } /** @@ -4619,9 +4599,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4854,9 +4832,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4978,7 +4954,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -5654,11 +5630,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6138,11 +6111,8 @@ private constructor( "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6163,7 +6133,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MATRIX, + MATRIX } /** @@ -6347,9 +6317,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -6582,9 +6550,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -6706,7 +6672,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -7382,11 +7348,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -7501,11 +7464,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -7526,7 +7486,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED, + TIERED } /** @@ -7688,7 +7648,7 @@ private constructor( fun build(): TieredConfig = TieredConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -8004,9 +7964,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -8239,9 +8197,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -8363,7 +8319,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -9040,11 +8996,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -9159,11 +9112,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -9184,7 +9134,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_BPS, + TIERED_BPS } /** @@ -9361,7 +9311,7 @@ private constructor( fun build(): TieredBpsConfig = TieredBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -9690,9 +9640,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -9925,9 +9873,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -10049,7 +9995,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -10857,11 +10803,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -10976,11 +10919,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -11001,7 +10941,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BPS, + BPS } /** @@ -11185,9 +11125,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11420,9 +11358,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11544,7 +11480,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -12332,7 +12268,7 @@ private constructor( fun build(): BulkBpsConfig = BulkBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -12518,11 +12454,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -12637,11 +12570,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -12662,7 +12592,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_BPS, + BULK_BPS } /** @@ -12846,9 +12776,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -13081,9 +13009,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -13205,7 +13131,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -13977,7 +13903,7 @@ private constructor( fun build(): BulkConfig = BulkConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -14145,11 +14071,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -14264,11 +14187,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -14289,7 +14209,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK, + BULK } /** @@ -14473,9 +14393,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -14708,9 +14626,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -14832,7 +14748,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -15519,11 +15435,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -15638,11 +15551,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -15663,7 +15573,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - THRESHOLD_TOTAL_AMOUNT, + THRESHOLD_TOTAL_AMOUNT } /** @@ -15732,7 +15642,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -15932,9 +15842,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16167,9 +16075,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16291,7 +16197,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -16971,11 +16877,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -17090,11 +16993,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -17115,7 +17015,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_PACKAGE, + TIERED_PACKAGE } /** @@ -17184,7 +17084,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -17383,9 +17283,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -17618,9 +17516,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -17742,7 +17638,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -18426,11 +18322,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -18545,11 +18438,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -18570,7 +18460,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_MINIMUM, + TIERED_WITH_MINIMUM } /** @@ -18639,7 +18529,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -18838,9 +18728,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -19073,9 +18961,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -19197,7 +19083,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -19879,11 +19765,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -19998,11 +19881,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -20023,7 +19903,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PERCENT, + UNIT_WITH_PERCENT } /** @@ -20092,7 +19972,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -20291,9 +20171,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -20526,9 +20404,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -20650,7 +20526,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -21337,11 +21213,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -21456,11 +21329,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -21481,7 +21351,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE_WITH_ALLOCATION, + PACKAGE_WITH_ALLOCATION } /** @@ -21550,7 +21420,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -21750,9 +21620,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21985,9 +21853,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -22109,7 +21975,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -22794,11 +22660,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -22913,11 +22776,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -22938,7 +22798,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_PRORATION, + TIERED_WITH_PRORATION } /** @@ -23007,7 +22867,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -23207,9 +23067,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -23442,9 +23300,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -23566,7 +23422,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -24250,11 +24106,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -24369,11 +24222,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -24394,7 +24244,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PRORATION, + UNIT_WITH_PRORATION } /** @@ -24463,7 +24313,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -24662,9 +24512,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24897,9 +24745,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -25021,7 +24867,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -25705,11 +25551,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -25829,7 +25672,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -25908,11 +25751,8 @@ private constructor( "GroupedAllocationConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -25933,7 +25773,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_ALLOCATION, + GROUPED_ALLOCATION } /** @@ -26117,9 +25957,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -26352,9 +26190,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -26476,7 +26312,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -27150,7 +26986,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired( "groupedWithProratedMinimumConfig", - groupedWithProratedMinimumConfig + groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), checkRequired("modelType", modelType), @@ -27170,11 +27006,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -27294,7 +27127,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -27375,11 +27208,8 @@ private constructor( "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -27401,7 +27231,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_WITH_PRORATED_MINIMUM, + GROUPED_WITH_PRORATED_MINIMUM } /** @@ -27585,9 +27415,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27820,9 +27648,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27944,7 +27770,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -28616,7 +28442,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired( "groupedWithMeteredMinimumConfig", - groupedWithMeteredMinimumConfig + groupedWithMeteredMinimumConfig, ), checkRequired("itemId", itemId), checkRequired("modelType", modelType), @@ -28636,11 +28462,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -28760,7 +28583,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -28841,11 +28664,8 @@ private constructor( "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -28866,7 +28686,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_WITH_METERED_MINIMUM, + GROUPED_WITH_METERED_MINIMUM } /** @@ -29050,9 +28870,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -29285,9 +29103,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -29409,7 +29225,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -30096,11 +29912,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -30220,7 +30033,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -30300,11 +30113,8 @@ private constructor( "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -30325,7 +30135,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MATRIX_WITH_DISPLAY_NAME, + MATRIX_WITH_DISPLAY_NAME } /** @@ -30509,9 +30319,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30744,9 +30552,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30868,7 +30674,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -31556,7 +31362,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -31636,11 +31442,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -31755,11 +31558,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -31780,7 +31580,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_WITH_PRORATION, + BULK_WITH_PRORATION } /** @@ -31964,9 +31764,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -32199,9 +31997,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -32323,7 +32119,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -33010,11 +32806,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -33134,7 +32927,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -33214,11 +33007,8 @@ private constructor( "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -33239,7 +33029,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_TIERED_PACKAGE, + GROUPED_TIERED_PACKAGE } /** @@ -33423,9 +33213,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33658,9 +33446,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33782,7 +33568,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -34469,11 +34255,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -34593,7 +34376,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -34673,11 +34456,8 @@ private constructor( "MaxGroupTieredPackageConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -34698,7 +34478,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MAX_GROUP_TIERED_PACKAGE, + MAX_GROUP_TIERED_PACKAGE } /** @@ -34882,9 +34662,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -35117,9 +34895,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -35241,7 +35017,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -35929,7 +35705,7 @@ private constructor( checkRequired("name", name), checkRequired( "scalableMatrixWithUnitPricingConfig", - scalableMatrixWithUnitPricingConfig + scalableMatrixWithUnitPricingConfig, ), billableMetricId, billedInAdvance, @@ -35946,11 +35722,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -36065,11 +35838,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -36091,7 +35861,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - SCALABLE_MATRIX_WITH_UNIT_PRICING, + SCALABLE_MATRIX_WITH_UNIT_PRICING } /** @@ -36160,7 +35930,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -36361,9 +36131,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -36596,9 +36364,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -36720,7 +36486,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -37410,7 +37176,7 @@ private constructor( checkRequired("name", name), checkRequired( "scalableMatrixWithTieredPricingConfig", - scalableMatrixWithTieredPricingConfig + scalableMatrixWithTieredPricingConfig, ), billableMetricId, billedInAdvance, @@ -37427,11 +37193,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -37546,11 +37309,8 @@ private constructor( override fun toString() = value.toString() } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -37573,7 +37333,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - SCALABLE_MATRIX_WITH_TIERED_PRICING, + SCALABLE_MATRIX_WITH_TIERED_PRICING } /** @@ -37644,7 +37404,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -37846,9 +37606,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -38081,9 +37839,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -38205,7 +37961,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -38892,11 +38648,8 @@ private constructor( } /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -39016,7 +38769,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -39096,11 +38849,8 @@ private constructor( "CumulativeGroupedBulkConfig{additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -39121,7 +38871,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - CUMULATIVE_GROUPED_BULK, + CUMULATIVE_GROUPED_BULK } /** @@ -39305,9 +39055,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -39540,9 +39288,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -39664,7 +39410,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -39769,7 +39515,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -39846,11 +39592,7 @@ private constructor( * The status of the plan to create (either active or draft). If not specified, this defaults to * active. */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 d570e8e0..14a1210b 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 @@ -28,7 +28,7 @@ import java.util.Optional class PlanExternalPlanIdUpdateParams private constructor( private val otherExternalPlanId: String, - private val body: PlanExternalPlanIdUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -67,7 +67,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): PlanExternalPlanIdUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -81,9 +81,9 @@ private constructor( } @NoAutoDetect - class PlanExternalPlanIdUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("external_plan_id") @ExcludeMissing private val externalPlanId: JsonField = JsonMissing.of(), @@ -131,7 +131,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanExternalPlanIdUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -148,7 +148,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanExternalPlanIdUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var externalPlanId: JsonField = JsonMissing.of() @@ -156,11 +156,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planExternalPlanIdUpdateBody: PlanExternalPlanIdUpdateBody) = apply { - externalPlanId = planExternalPlanIdUpdateBody.externalPlanId - metadata = planExternalPlanIdUpdateBody.metadata - additionalProperties = - planExternalPlanIdUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + externalPlanId = body.externalPlanId + metadata = body.metadata + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -228,12 +227,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): PlanExternalPlanIdUpdateBody = - PlanExternalPlanIdUpdateBody( - externalPlanId, - metadata, - additionalProperties.toImmutable(), - ) + fun build(): Body = Body(externalPlanId, metadata, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -241,7 +235,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanExternalPlanIdUpdateBody && externalPlanId == other.externalPlanId && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && externalPlanId == other.externalPlanId && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -251,7 +245,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanExternalPlanIdUpdateBody{externalPlanId=$externalPlanId, metadata=$metadata, additionalProperties=$additionalProperties}" + "Body{externalPlanId=$externalPlanId, metadata=$metadata, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -266,8 +260,7 @@ private constructor( class Builder internal constructor() { private var otherExternalPlanId: String? = null - private var body: PlanExternalPlanIdUpdateBody.Builder = - PlanExternalPlanIdUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -464,7 +457,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 3729a838..47073652 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 @@ -82,11 +82,7 @@ private constructor( @JvmStatic fun of(plansService: PlanService, params: PlanListParams, response: Response) = - PlanListPage( - plansService, - params, - response, - ) + PlanListPage(plansService, params, response) } @NoAutoDetect @@ -176,18 +172,11 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: PlanListPage, - ) : Iterable { + class AutoPager(private val firstPage: PlanListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 0bbcddc9..422e2132 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 @@ -85,11 +85,7 @@ private constructor( @JvmStatic fun of(plansService: PlanServiceAsync, params: PlanListParams, response: Response) = - PlanListPageAsync( - plansService, - params, - response, - ) + PlanListPageAsync(plansService, params, response) } @NoAutoDetect @@ -179,23 +175,16 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: PlanListPageAsync, - ) { + class AutoPager(private val firstPage: PlanListPageAsync) { fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( action: (Plan) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -204,7 +193,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt index cbfd5902..13653bcb 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt @@ -65,25 +65,25 @@ private constructor( this.createdAtGt?.let { queryParams.put( "created_at[gt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtGte?.let { queryParams.put( "created_at[gte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLt?.let { queryParams.put( "created_at[lt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLte?.let { queryParams.put( "created_at[lte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) } @@ -288,11 +288,7 @@ private constructor( } /** The plan status to filter to ('active', 'archived', or 'draft'). */ - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 e3812e14..efc138f9 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 @@ -28,7 +28,7 @@ import java.util.Optional class PlanUpdateParams private constructor( private val planId: String, - private val body: PlanUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -67,7 +67,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): PlanUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -81,9 +81,9 @@ private constructor( } @NoAutoDetect - class PlanUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("external_plan_id") @ExcludeMissing private val externalPlanId: JsonField = JsonMissing.of(), @@ -131,7 +131,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PlanUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -148,7 +148,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PlanUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var externalPlanId: JsonField = JsonMissing.of() @@ -156,10 +156,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(planUpdateBody: PlanUpdateBody) = apply { - externalPlanId = planUpdateBody.externalPlanId - metadata = planUpdateBody.metadata - additionalProperties = planUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + externalPlanId = body.externalPlanId + metadata = body.metadata + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -227,12 +227,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): PlanUpdateBody = - PlanUpdateBody( - externalPlanId, - metadata, - additionalProperties.toImmutable(), - ) + fun build(): Body = Body(externalPlanId, metadata, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -240,7 +235,7 @@ private constructor( return true } - return /* spotless:off */ other is PlanUpdateBody && externalPlanId == other.externalPlanId && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && externalPlanId == other.externalPlanId && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -250,7 +245,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PlanUpdateBody{externalPlanId=$externalPlanId, metadata=$metadata, additionalProperties=$additionalProperties}" + "Body{externalPlanId=$externalPlanId, metadata=$metadata, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -265,7 +260,7 @@ private constructor( class Builder internal constructor() { private var planId: String? = null - private var body: PlanUpdateBody.Builder = PlanUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -460,7 +455,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 5dbc1aa1..f9e71be5 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 @@ -923,7 +923,7 @@ private constructor( override fun serialize( value: Price, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.unit != null -> generator.writeObject(value.unit) @@ -1771,9 +1771,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1883,11 +1881,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2227,9 +2222,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2629,7 +2622,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -2870,11 +2863,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2895,7 +2885,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT, + UNIT } /** @@ -2959,11 +2949,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3140,7 +3127,7 @@ private constructor( fun build(): UnitConfig = UnitConfig( checkRequired("unitAmount", unitAmount), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -4122,9 +4109,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4234,11 +4219,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4578,9 +4560,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4980,7 +4960,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -5221,11 +5201,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5246,7 +5223,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE, + PACKAGE } /** @@ -5454,11 +5431,8 @@ private constructor( "PackageConfig{packageAmount=$packageAmount, packageSize=$packageSize, additionalProperties=$additionalProperties}" } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6508,9 +6482,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -6620,11 +6592,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6964,9 +6933,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -7723,7 +7690,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -7964,11 +7931,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -7989,7 +7953,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MATRIX, + MATRIX } /** @@ -8053,11 +8017,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -9107,9 +9068,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -9219,11 +9178,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -9563,9 +9519,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -9965,7 +9919,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -10206,11 +10160,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -10231,7 +10182,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED, + TIERED } /** @@ -10295,11 +10246,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -10488,7 +10436,7 @@ private constructor( fun build(): TieredConfig = TieredConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -11631,9 +11579,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11743,11 +11689,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -12087,9 +12030,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -12489,7 +12430,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -12730,11 +12671,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -12755,7 +12693,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_BPS, + TIERED_BPS } /** @@ -12819,11 +12757,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -13025,7 +12960,7 @@ private constructor( fun build(): TieredBpsConfig = TieredBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -14190,9 +14125,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -14435,11 +14368,8 @@ private constructor( "BpsConfig{bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -14779,9 +14709,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -15181,7 +15109,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -15422,11 +15350,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -15447,7 +15372,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BPS, + BPS } /** @@ -15511,11 +15436,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -16566,9 +16488,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16791,7 +16711,7 @@ private constructor( fun build(): BulkBpsConfig = BulkBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -16975,11 +16895,8 @@ private constructor( "BulkBpsConfig{tiers=$tiers, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -17319,9 +17236,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -17721,7 +17636,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -17962,11 +17877,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -17987,7 +17899,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_BPS, + BULK_BPS } /** @@ -18051,11 +17963,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -19105,9 +19014,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -19315,7 +19222,7 @@ private constructor( fun build(): BulkConfig = BulkConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -19478,11 +19385,8 @@ private constructor( "BulkConfig{tiers=$tiers, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -19822,9 +19726,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -20224,7 +20126,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -20465,11 +20367,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -20490,7 +20389,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK, + BULK } /** @@ -20554,11 +20453,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -21613,9 +21509,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21725,11 +21619,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -22069,9 +21960,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -22471,7 +22360,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -22712,11 +22601,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -22737,7 +22623,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - THRESHOLD_TOTAL_AMOUNT, + THRESHOLD_TOTAL_AMOUNT } /** @@ -22801,11 +22687,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -22901,7 +22784,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -23941,9 +23824,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24053,11 +23934,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -24397,9 +24275,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24799,7 +24675,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -25040,11 +24916,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -25065,7 +24938,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_PACKAGE, + TIERED_PACKAGE } /** @@ -25129,11 +25002,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -25229,7 +25099,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -26268,9 +26138,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -26380,11 +26248,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -26623,7 +26488,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -26807,9 +26672,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27209,7 +27072,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -27450,11 +27313,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -27475,7 +27335,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_TIERED, + GROUPED_TIERED } /** @@ -27539,11 +27399,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -28595,9 +28452,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -28707,11 +28562,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -29051,9 +28903,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -29453,7 +29303,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -29694,11 +29544,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -29719,7 +29566,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_MINIMUM, + TIERED_WITH_MINIMUM } /** @@ -29783,11 +29630,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -29883,7 +29727,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -30933,9 +30777,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -31045,11 +30887,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -31389,9 +31228,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -31791,7 +31628,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -32032,11 +31869,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -32057,7 +31891,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_PACKAGE_WITH_MINIMUM, + TIERED_PACKAGE_WITH_MINIMUM } /** @@ -32121,11 +31955,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -32221,7 +32052,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -33267,9 +33098,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33379,11 +33208,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -33723,9 +33549,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -34125,7 +33949,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -34366,11 +34190,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -34391,7 +34212,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE_WITH_ALLOCATION, + PACKAGE_WITH_ALLOCATION } /** @@ -34460,7 +34281,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -34540,11 +34361,8 @@ private constructor( "PackageWithAllocationConfig{additionalProperties=$additionalProperties}" } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -35597,9 +35415,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -35709,11 +35525,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -36053,9 +35866,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -36455,7 +36266,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -36696,11 +36507,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -36721,7 +36529,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PERCENT, + UNIT_WITH_PERCENT } /** @@ -36785,11 +36593,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -36885,7 +36690,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -37927,9 +37732,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -38039,11 +37842,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -38383,9 +38183,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -39167,7 +38965,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -39408,11 +39206,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -39433,7 +39228,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MATRIX_WITH_ALLOCATION, + MATRIX_WITH_ALLOCATION } /** @@ -39497,11 +39292,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -40556,9 +40348,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -40668,11 +40458,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -41012,9 +40799,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -41414,7 +41199,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -41655,11 +41440,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -41680,7 +41462,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_PRORATION, + TIERED_WITH_PRORATION } /** @@ -41744,11 +41526,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -41844,7 +41623,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -42884,9 +42663,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -42996,11 +42773,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -43340,9 +43114,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -43742,7 +43514,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -43983,11 +43755,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -44008,7 +43777,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PRORATION, + UNIT_WITH_PRORATION } /** @@ -44072,11 +43841,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -44172,7 +43938,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -45212,9 +44978,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -45324,11 +45088,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -45567,7 +45328,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -45752,9 +45513,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -46154,7 +45913,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -46395,11 +46154,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -46420,7 +46176,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_ALLOCATION, + GROUPED_ALLOCATION } /** @@ -46484,11 +46240,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -47334,7 +47087,7 @@ private constructor( checkRequired("fixedPriceQuantity", fixedPriceQuantity), checkRequired( "groupedWithProratedMinimumConfig", - groupedWithProratedMinimumConfig + groupedWithProratedMinimumConfig, ), checkRequired("invoicingCycleConfiguration", invoicingCycleConfiguration), checkRequired("item", item), @@ -47554,9 +47307,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -47666,11 +47417,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -47909,7 +47657,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -48096,9 +47844,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -48498,7 +48244,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -48739,11 +48485,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -48764,7 +48507,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_WITH_PRORATED_MINIMUM, + GROUPED_WITH_PRORATED_MINIMUM } /** @@ -48828,11 +48571,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -49678,7 +49418,7 @@ private constructor( checkRequired("fixedPriceQuantity", fixedPriceQuantity), checkRequired( "groupedWithMeteredMinimumConfig", - groupedWithMeteredMinimumConfig + groupedWithMeteredMinimumConfig, ), checkRequired("invoicingCycleConfiguration", invoicingCycleConfiguration), checkRequired("item", item), @@ -49898,9 +49638,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -50010,11 +49748,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -50253,7 +49988,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -50440,9 +50175,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -50842,7 +50575,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -51083,11 +50816,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -51108,7 +50838,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_WITH_METERED_MINIMUM, + GROUPED_WITH_METERED_MINIMUM } /** @@ -51172,11 +50902,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -52233,9 +51960,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -52345,11 +52070,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -52689,9 +52411,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -52921,7 +52641,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -53176,7 +52896,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -53417,11 +53137,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -53442,7 +53159,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MATRIX_WITH_DISPLAY_NAME, + MATRIX_WITH_DISPLAY_NAME } /** @@ -53506,11 +53223,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -54562,9 +54276,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -54679,7 +54391,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -54758,11 +54470,8 @@ private constructor( "BulkWithProrationConfig{additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -55102,9 +54811,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -55504,7 +55211,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -55745,11 +55452,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -55770,7 +55474,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_WITH_PRORATION, + BULK_WITH_PRORATION } /** @@ -55834,11 +55538,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -56893,9 +56594,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -57005,11 +56704,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -57248,7 +56944,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -57433,9 +57129,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -57835,7 +57529,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -58076,11 +57770,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -58101,7 +57792,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_TIERED_PACKAGE, + GROUPED_TIERED_PACKAGE } /** @@ -58165,11 +57856,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -59226,9 +58914,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -59338,11 +59024,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -59682,9 +59365,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -59914,7 +59595,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -60169,7 +59850,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -60410,11 +60091,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -60435,7 +60113,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MAX_GROUP_TIERED_PACKAGE, + MAX_GROUP_TIERED_PACKAGE } /** @@ -60499,11 +60177,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -61369,7 +61044,7 @@ private constructor( checkRequired("priceType", priceType), checkRequired( "scalableMatrixWithUnitPricingConfig", - scalableMatrixWithUnitPricingConfig + scalableMatrixWithUnitPricingConfig, ), dimensionalPriceConfiguration, additionalProperties.toImmutable(), @@ -61578,9 +61253,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -61690,11 +61363,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -62034,9 +61704,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -62436,7 +62104,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -62677,11 +62345,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -62703,7 +62368,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - SCALABLE_MATRIX_WITH_UNIT_PRICING, + SCALABLE_MATRIX_WITH_UNIT_PRICING } /** @@ -62767,11 +62432,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -62867,7 +62529,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -63724,7 +63386,7 @@ private constructor( checkRequired("priceType", priceType), checkRequired( "scalableMatrixWithTieredPricingConfig", - scalableMatrixWithTieredPricingConfig + scalableMatrixWithTieredPricingConfig, ), dimensionalPriceConfiguration, additionalProperties.toImmutable(), @@ -63933,9 +63595,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -64045,11 +63705,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -64389,9 +64046,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -64791,7 +64446,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -65032,11 +64687,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -65058,7 +64710,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - SCALABLE_MATRIX_WITH_TIERED_PRICING, + SCALABLE_MATRIX_WITH_TIERED_PRICING } /** @@ -65122,11 +64774,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -65222,7 +64871,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -66269,9 +65918,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -66381,11 +66028,8 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -66624,7 +66268,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -66810,9 +66454,7 @@ private constructor( class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -67212,7 +66854,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -67453,11 +67095,8 @@ private constructor( "Minimum{appliesToPriceIds=$appliesToPriceIds, minimumAmount=$minimumAmount, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -67478,7 +67117,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - CUMULATIVE_GROUPED_BULK, + CUMULATIVE_GROUPED_BULK } /** @@ -67542,11 +67181,8 @@ private constructor( override fun toString() = value.toString() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PriceType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. 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 e9b9aa73..f7a1644a 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 @@ -47,109 +47,27 @@ import kotlin.jvm.optionals.getOrNull */ class PriceCreateParams private constructor( - private val body: PriceCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun newFloatingUnitPrice(): Optional = body.newFloatingUnitPrice() - - fun newFloatingPackagePrice(): Optional = - body.newFloatingPackagePrice() - - fun newFloatingMatrixPrice(): Optional = body.newFloatingMatrixPrice() - - fun newFloatingMatrixWithAllocationPrice(): Optional = - body.newFloatingMatrixWithAllocationPrice() - - fun newFloatingTieredPrice(): Optional = body.newFloatingTieredPrice() - - fun newFloatingTieredBpsPrice(): Optional = - body.newFloatingTieredBpsPrice() - - fun newFloatingBpsPrice(): Optional = body.newFloatingBpsPrice() - - fun newFloatingBulkBpsPrice(): Optional = - body.newFloatingBulkBpsPrice() - - fun newFloatingBulkPrice(): Optional = body.newFloatingBulkPrice() - - fun newFloatingThresholdTotalAmountPrice(): Optional = - body.newFloatingThresholdTotalAmountPrice() - - fun newFloatingTieredPackagePrice(): Optional = - body.newFloatingTieredPackagePrice() - - fun newFloatingGroupedTieredPrice(): Optional = - body.newFloatingGroupedTieredPrice() - - fun newFloatingMaxGroupTieredPackagePrice(): Optional = - body.newFloatingMaxGroupTieredPackagePrice() - - fun newFloatingTieredWithMinimumPrice(): Optional = - body.newFloatingTieredWithMinimumPrice() - - fun newFloatingPackageWithAllocationPrice(): Optional = - body.newFloatingPackageWithAllocationPrice() - - fun newFloatingTieredPackageWithMinimumPrice(): - Optional = - body.newFloatingTieredPackageWithMinimumPrice() - - fun newFloatingUnitWithPercentPrice(): Optional = - body.newFloatingUnitWithPercentPrice() - - fun newFloatingTieredWithProrationPrice(): Optional = - body.newFloatingTieredWithProrationPrice() - - fun newFloatingUnitWithProrationPrice(): Optional = - body.newFloatingUnitWithProrationPrice() - - fun newFloatingGroupedAllocationPrice(): Optional = - body.newFloatingGroupedAllocationPrice() - - fun newFloatingGroupedWithProratedMinimumPrice(): - Optional = - body.newFloatingGroupedWithProratedMinimumPrice() - - fun newFloatingGroupedWithMeteredMinimumPrice(): - Optional = - body.newFloatingGroupedWithMeteredMinimumPrice() - - fun newFloatingMatrixWithDisplayNamePrice(): Optional = - body.newFloatingMatrixWithDisplayNamePrice() - - fun newFloatingBulkWithProrationPrice(): Optional = - body.newFloatingBulkWithProrationPrice() - - fun newFloatingGroupedTieredPackagePrice(): Optional = - body.newFloatingGroupedTieredPackagePrice() - - fun newFloatingScalableMatrixWithUnitPricingPrice(): - Optional = - body.newFloatingScalableMatrixWithUnitPricingPrice() - - fun newFloatingScalableMatrixWithTieredPricingPrice(): - Optional = - body.newFloatingScalableMatrixWithTieredPricingPrice() - - fun newFloatingCumulativeGroupedBulkPrice(): Optional = - body.newFloatingCumulativeGroupedBulkPrice() + fun body(): Body = body fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): PriceCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(using = PriceCreateBody.Deserializer::class) - @JsonSerialize(using = PriceCreateBody.Serializer::class) - class PriceCreateBody - internal constructor( + @JsonDeserialize(using = Body.Deserializer::class) + @JsonSerialize(using = Body.Serializer::class) + class Body + private constructor( private val newFloatingUnitPrice: NewFloatingUnitPrice? = null, private val newFloatingPackagePrice: NewFloatingPackagePrice? = null, private val newFloatingMatrixPrice: NewFloatingMatrixPrice? = null, @@ -568,167 +486,335 @@ private constructor( } } + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitNewFloatingUnitPrice( + newFloatingUnitPrice: NewFloatingUnitPrice + ) { + newFloatingUnitPrice.validate() + } + + override fun visitNewFloatingPackagePrice( + newFloatingPackagePrice: NewFloatingPackagePrice + ) { + newFloatingPackagePrice.validate() + } + + override fun visitNewFloatingMatrixPrice( + newFloatingMatrixPrice: NewFloatingMatrixPrice + ) { + newFloatingMatrixPrice.validate() + } + + override fun visitNewFloatingMatrixWithAllocationPrice( + newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice + ) { + newFloatingMatrixWithAllocationPrice.validate() + } + + override fun visitNewFloatingTieredPrice( + newFloatingTieredPrice: NewFloatingTieredPrice + ) { + newFloatingTieredPrice.validate() + } + + override fun visitNewFloatingTieredBpsPrice( + newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice + ) { + newFloatingTieredBpsPrice.validate() + } + + override fun visitNewFloatingBpsPrice( + newFloatingBpsPrice: NewFloatingBpsPrice + ) { + newFloatingBpsPrice.validate() + } + + override fun visitNewFloatingBulkBpsPrice( + newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice + ) { + newFloatingBulkBpsPrice.validate() + } + + override fun visitNewFloatingBulkPrice( + newFloatingBulkPrice: NewFloatingBulkPrice + ) { + newFloatingBulkPrice.validate() + } + + override fun visitNewFloatingThresholdTotalAmountPrice( + newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice + ) { + newFloatingThresholdTotalAmountPrice.validate() + } + + override fun visitNewFloatingTieredPackagePrice( + newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice + ) { + newFloatingTieredPackagePrice.validate() + } + + override fun visitNewFloatingGroupedTieredPrice( + newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice + ) { + newFloatingGroupedTieredPrice.validate() + } + + override fun visitNewFloatingMaxGroupTieredPackagePrice( + newFloatingMaxGroupTieredPackagePrice: NewFloatingMaxGroupTieredPackagePrice + ) { + newFloatingMaxGroupTieredPackagePrice.validate() + } + + override fun visitNewFloatingTieredWithMinimumPrice( + newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice + ) { + newFloatingTieredWithMinimumPrice.validate() + } + + override fun visitNewFloatingPackageWithAllocationPrice( + newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice + ) { + newFloatingPackageWithAllocationPrice.validate() + } + + override fun visitNewFloatingTieredPackageWithMinimumPrice( + newFloatingTieredPackageWithMinimumPrice: + NewFloatingTieredPackageWithMinimumPrice + ) { + newFloatingTieredPackageWithMinimumPrice.validate() + } + + override fun visitNewFloatingUnitWithPercentPrice( + newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice + ) { + newFloatingUnitWithPercentPrice.validate() + } + + override fun visitNewFloatingTieredWithProrationPrice( + newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice + ) { + newFloatingTieredWithProrationPrice.validate() + } + + override fun visitNewFloatingUnitWithProrationPrice( + newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice + ) { + newFloatingUnitWithProrationPrice.validate() + } + + override fun visitNewFloatingGroupedAllocationPrice( + newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice + ) { + newFloatingGroupedAllocationPrice.validate() + } + + override fun visitNewFloatingGroupedWithProratedMinimumPrice( + newFloatingGroupedWithProratedMinimumPrice: + NewFloatingGroupedWithProratedMinimumPrice + ) { + newFloatingGroupedWithProratedMinimumPrice.validate() + } + + override fun visitNewFloatingGroupedWithMeteredMinimumPrice( + newFloatingGroupedWithMeteredMinimumPrice: + NewFloatingGroupedWithMeteredMinimumPrice + ) { + newFloatingGroupedWithMeteredMinimumPrice.validate() + } + + override fun visitNewFloatingMatrixWithDisplayNamePrice( + newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice + ) { + newFloatingMatrixWithDisplayNamePrice.validate() + } + + override fun visitNewFloatingBulkWithProrationPrice( + newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice + ) { + newFloatingBulkWithProrationPrice.validate() + } + + override fun visitNewFloatingGroupedTieredPackagePrice( + newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice + ) { + newFloatingGroupedTieredPackagePrice.validate() + } + + override fun visitNewFloatingScalableMatrixWithUnitPricingPrice( + newFloatingScalableMatrixWithUnitPricingPrice: + NewFloatingScalableMatrixWithUnitPricingPrice + ) { + newFloatingScalableMatrixWithUnitPricingPrice.validate() + } + + override fun visitNewFloatingScalableMatrixWithTieredPricingPrice( + newFloatingScalableMatrixWithTieredPricingPrice: + NewFloatingScalableMatrixWithTieredPricingPrice + ) { + newFloatingScalableMatrixWithTieredPricingPrice.validate() + } + + override fun visitNewFloatingCumulativeGroupedBulkPrice( + newFloatingCumulativeGroupedBulkPrice: NewFloatingCumulativeGroupedBulkPrice + ) { + newFloatingCumulativeGroupedBulkPrice.validate() + } + } + ) + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is PriceCreateBody && 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 && 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 */ } 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 toString(): String = when { - newFloatingUnitPrice != null -> - "PriceCreateBody{newFloatingUnitPrice=$newFloatingUnitPrice}" + newFloatingUnitPrice != null -> "Body{newFloatingUnitPrice=$newFloatingUnitPrice}" newFloatingPackagePrice != null -> - "PriceCreateBody{newFloatingPackagePrice=$newFloatingPackagePrice}" + "Body{newFloatingPackagePrice=$newFloatingPackagePrice}" newFloatingMatrixPrice != null -> - "PriceCreateBody{newFloatingMatrixPrice=$newFloatingMatrixPrice}" + "Body{newFloatingMatrixPrice=$newFloatingMatrixPrice}" newFloatingMatrixWithAllocationPrice != null -> - "PriceCreateBody{newFloatingMatrixWithAllocationPrice=$newFloatingMatrixWithAllocationPrice}" + "Body{newFloatingMatrixWithAllocationPrice=$newFloatingMatrixWithAllocationPrice}" newFloatingTieredPrice != null -> - "PriceCreateBody{newFloatingTieredPrice=$newFloatingTieredPrice}" + "Body{newFloatingTieredPrice=$newFloatingTieredPrice}" newFloatingTieredBpsPrice != null -> - "PriceCreateBody{newFloatingTieredBpsPrice=$newFloatingTieredBpsPrice}" - newFloatingBpsPrice != null -> - "PriceCreateBody{newFloatingBpsPrice=$newFloatingBpsPrice}" + "Body{newFloatingTieredBpsPrice=$newFloatingTieredBpsPrice}" + newFloatingBpsPrice != null -> "Body{newFloatingBpsPrice=$newFloatingBpsPrice}" newFloatingBulkBpsPrice != null -> - "PriceCreateBody{newFloatingBulkBpsPrice=$newFloatingBulkBpsPrice}" - newFloatingBulkPrice != null -> - "PriceCreateBody{newFloatingBulkPrice=$newFloatingBulkPrice}" + "Body{newFloatingBulkBpsPrice=$newFloatingBulkBpsPrice}" + newFloatingBulkPrice != null -> "Body{newFloatingBulkPrice=$newFloatingBulkPrice}" newFloatingThresholdTotalAmountPrice != null -> - "PriceCreateBody{newFloatingThresholdTotalAmountPrice=$newFloatingThresholdTotalAmountPrice}" + "Body{newFloatingThresholdTotalAmountPrice=$newFloatingThresholdTotalAmountPrice}" newFloatingTieredPackagePrice != null -> - "PriceCreateBody{newFloatingTieredPackagePrice=$newFloatingTieredPackagePrice}" + "Body{newFloatingTieredPackagePrice=$newFloatingTieredPackagePrice}" newFloatingGroupedTieredPrice != null -> - "PriceCreateBody{newFloatingGroupedTieredPrice=$newFloatingGroupedTieredPrice}" + "Body{newFloatingGroupedTieredPrice=$newFloatingGroupedTieredPrice}" newFloatingMaxGroupTieredPackagePrice != null -> - "PriceCreateBody{newFloatingMaxGroupTieredPackagePrice=$newFloatingMaxGroupTieredPackagePrice}" + "Body{newFloatingMaxGroupTieredPackagePrice=$newFloatingMaxGroupTieredPackagePrice}" newFloatingTieredWithMinimumPrice != null -> - "PriceCreateBody{newFloatingTieredWithMinimumPrice=$newFloatingTieredWithMinimumPrice}" + "Body{newFloatingTieredWithMinimumPrice=$newFloatingTieredWithMinimumPrice}" newFloatingPackageWithAllocationPrice != null -> - "PriceCreateBody{newFloatingPackageWithAllocationPrice=$newFloatingPackageWithAllocationPrice}" + "Body{newFloatingPackageWithAllocationPrice=$newFloatingPackageWithAllocationPrice}" newFloatingTieredPackageWithMinimumPrice != null -> - "PriceCreateBody{newFloatingTieredPackageWithMinimumPrice=$newFloatingTieredPackageWithMinimumPrice}" + "Body{newFloatingTieredPackageWithMinimumPrice=$newFloatingTieredPackageWithMinimumPrice}" newFloatingUnitWithPercentPrice != null -> - "PriceCreateBody{newFloatingUnitWithPercentPrice=$newFloatingUnitWithPercentPrice}" + "Body{newFloatingUnitWithPercentPrice=$newFloatingUnitWithPercentPrice}" newFloatingTieredWithProrationPrice != null -> - "PriceCreateBody{newFloatingTieredWithProrationPrice=$newFloatingTieredWithProrationPrice}" + "Body{newFloatingTieredWithProrationPrice=$newFloatingTieredWithProrationPrice}" newFloatingUnitWithProrationPrice != null -> - "PriceCreateBody{newFloatingUnitWithProrationPrice=$newFloatingUnitWithProrationPrice}" + "Body{newFloatingUnitWithProrationPrice=$newFloatingUnitWithProrationPrice}" newFloatingGroupedAllocationPrice != null -> - "PriceCreateBody{newFloatingGroupedAllocationPrice=$newFloatingGroupedAllocationPrice}" + "Body{newFloatingGroupedAllocationPrice=$newFloatingGroupedAllocationPrice}" newFloatingGroupedWithProratedMinimumPrice != null -> - "PriceCreateBody{newFloatingGroupedWithProratedMinimumPrice=$newFloatingGroupedWithProratedMinimumPrice}" + "Body{newFloatingGroupedWithProratedMinimumPrice=$newFloatingGroupedWithProratedMinimumPrice}" newFloatingGroupedWithMeteredMinimumPrice != null -> - "PriceCreateBody{newFloatingGroupedWithMeteredMinimumPrice=$newFloatingGroupedWithMeteredMinimumPrice}" + "Body{newFloatingGroupedWithMeteredMinimumPrice=$newFloatingGroupedWithMeteredMinimumPrice}" newFloatingMatrixWithDisplayNamePrice != null -> - "PriceCreateBody{newFloatingMatrixWithDisplayNamePrice=$newFloatingMatrixWithDisplayNamePrice}" + "Body{newFloatingMatrixWithDisplayNamePrice=$newFloatingMatrixWithDisplayNamePrice}" newFloatingBulkWithProrationPrice != null -> - "PriceCreateBody{newFloatingBulkWithProrationPrice=$newFloatingBulkWithProrationPrice}" + "Body{newFloatingBulkWithProrationPrice=$newFloatingBulkWithProrationPrice}" newFloatingGroupedTieredPackagePrice != null -> - "PriceCreateBody{newFloatingGroupedTieredPackagePrice=$newFloatingGroupedTieredPackagePrice}" + "Body{newFloatingGroupedTieredPackagePrice=$newFloatingGroupedTieredPackagePrice}" newFloatingScalableMatrixWithUnitPricingPrice != null -> - "PriceCreateBody{newFloatingScalableMatrixWithUnitPricingPrice=$newFloatingScalableMatrixWithUnitPricingPrice}" + "Body{newFloatingScalableMatrixWithUnitPricingPrice=$newFloatingScalableMatrixWithUnitPricingPrice}" newFloatingScalableMatrixWithTieredPricingPrice != null -> - "PriceCreateBody{newFloatingScalableMatrixWithTieredPricingPrice=$newFloatingScalableMatrixWithTieredPricingPrice}" + "Body{newFloatingScalableMatrixWithTieredPricingPrice=$newFloatingScalableMatrixWithTieredPricingPrice}" newFloatingCumulativeGroupedBulkPrice != null -> - "PriceCreateBody{newFloatingCumulativeGroupedBulkPrice=$newFloatingCumulativeGroupedBulkPrice}" - _json != null -> "PriceCreateBody{_unknown=$_json}" - else -> throw IllegalStateException("Invalid PriceCreateBody") + "Body{newFloatingCumulativeGroupedBulkPrice=$newFloatingCumulativeGroupedBulkPrice}" + _json != null -> "Body{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Body") } companion object { @JvmStatic fun ofNewFloatingUnitPrice(newFloatingUnitPrice: NewFloatingUnitPrice) = - PriceCreateBody(newFloatingUnitPrice = newFloatingUnitPrice) + Body(newFloatingUnitPrice = newFloatingUnitPrice) @JvmStatic fun ofNewFloatingPackagePrice(newFloatingPackagePrice: NewFloatingPackagePrice) = - PriceCreateBody(newFloatingPackagePrice = newFloatingPackagePrice) + Body(newFloatingPackagePrice = newFloatingPackagePrice) @JvmStatic fun ofNewFloatingMatrixPrice(newFloatingMatrixPrice: NewFloatingMatrixPrice) = - PriceCreateBody(newFloatingMatrixPrice = newFloatingMatrixPrice) + Body(newFloatingMatrixPrice = newFloatingMatrixPrice) @JvmStatic fun ofNewFloatingMatrixWithAllocationPrice( newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice - ) = - PriceCreateBody( - newFloatingMatrixWithAllocationPrice = newFloatingMatrixWithAllocationPrice - ) + ) = Body(newFloatingMatrixWithAllocationPrice = newFloatingMatrixWithAllocationPrice) @JvmStatic fun ofNewFloatingTieredPrice(newFloatingTieredPrice: NewFloatingTieredPrice) = - PriceCreateBody(newFloatingTieredPrice = newFloatingTieredPrice) + Body(newFloatingTieredPrice = newFloatingTieredPrice) @JvmStatic fun ofNewFloatingTieredBpsPrice(newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice) = - PriceCreateBody(newFloatingTieredBpsPrice = newFloatingTieredBpsPrice) + Body(newFloatingTieredBpsPrice = newFloatingTieredBpsPrice) @JvmStatic fun ofNewFloatingBpsPrice(newFloatingBpsPrice: NewFloatingBpsPrice) = - PriceCreateBody(newFloatingBpsPrice = newFloatingBpsPrice) + Body(newFloatingBpsPrice = newFloatingBpsPrice) @JvmStatic fun ofNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice) = - PriceCreateBody(newFloatingBulkBpsPrice = newFloatingBulkBpsPrice) + Body(newFloatingBulkBpsPrice = newFloatingBulkBpsPrice) @JvmStatic fun ofNewFloatingBulkPrice(newFloatingBulkPrice: NewFloatingBulkPrice) = - PriceCreateBody(newFloatingBulkPrice = newFloatingBulkPrice) + Body(newFloatingBulkPrice = newFloatingBulkPrice) @JvmStatic fun ofNewFloatingThresholdTotalAmountPrice( newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice - ) = - PriceCreateBody( - newFloatingThresholdTotalAmountPrice = newFloatingThresholdTotalAmountPrice - ) + ) = Body(newFloatingThresholdTotalAmountPrice = newFloatingThresholdTotalAmountPrice) @JvmStatic fun ofNewFloatingTieredPackagePrice( newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice - ) = PriceCreateBody(newFloatingTieredPackagePrice = newFloatingTieredPackagePrice) + ) = Body(newFloatingTieredPackagePrice = newFloatingTieredPackagePrice) @JvmStatic fun ofNewFloatingGroupedTieredPrice( newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice - ) = PriceCreateBody(newFloatingGroupedTieredPrice = newFloatingGroupedTieredPrice) + ) = Body(newFloatingGroupedTieredPrice = newFloatingGroupedTieredPrice) @JvmStatic fun ofNewFloatingMaxGroupTieredPackagePrice( newFloatingMaxGroupTieredPackagePrice: NewFloatingMaxGroupTieredPackagePrice - ) = - PriceCreateBody( - newFloatingMaxGroupTieredPackagePrice = newFloatingMaxGroupTieredPackagePrice - ) + ) = Body(newFloatingMaxGroupTieredPackagePrice = newFloatingMaxGroupTieredPackagePrice) @JvmStatic fun ofNewFloatingTieredWithMinimumPrice( newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice - ) = - PriceCreateBody( - newFloatingTieredWithMinimumPrice = newFloatingTieredWithMinimumPrice - ) + ) = Body(newFloatingTieredWithMinimumPrice = newFloatingTieredWithMinimumPrice) @JvmStatic fun ofNewFloatingPackageWithAllocationPrice( newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice - ) = - PriceCreateBody( - newFloatingPackageWithAllocationPrice = newFloatingPackageWithAllocationPrice - ) + ) = Body(newFloatingPackageWithAllocationPrice = newFloatingPackageWithAllocationPrice) @JvmStatic fun ofNewFloatingTieredPackageWithMinimumPrice( newFloatingTieredPackageWithMinimumPrice: NewFloatingTieredPackageWithMinimumPrice ) = - PriceCreateBody( + Body( newFloatingTieredPackageWithMinimumPrice = newFloatingTieredPackageWithMinimumPrice ) @@ -736,38 +822,29 @@ private constructor( @JvmStatic fun ofNewFloatingUnitWithPercentPrice( newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice - ) = PriceCreateBody(newFloatingUnitWithPercentPrice = newFloatingUnitWithPercentPrice) + ) = Body(newFloatingUnitWithPercentPrice = newFloatingUnitWithPercentPrice) @JvmStatic fun ofNewFloatingTieredWithProrationPrice( newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice - ) = - PriceCreateBody( - newFloatingTieredWithProrationPrice = newFloatingTieredWithProrationPrice - ) + ) = Body(newFloatingTieredWithProrationPrice = newFloatingTieredWithProrationPrice) @JvmStatic fun ofNewFloatingUnitWithProrationPrice( newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice - ) = - PriceCreateBody( - newFloatingUnitWithProrationPrice = newFloatingUnitWithProrationPrice - ) + ) = Body(newFloatingUnitWithProrationPrice = newFloatingUnitWithProrationPrice) @JvmStatic fun ofNewFloatingGroupedAllocationPrice( newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice - ) = - PriceCreateBody( - newFloatingGroupedAllocationPrice = newFloatingGroupedAllocationPrice - ) + ) = Body(newFloatingGroupedAllocationPrice = newFloatingGroupedAllocationPrice) @JvmStatic fun ofNewFloatingGroupedWithProratedMinimumPrice( newFloatingGroupedWithProratedMinimumPrice: NewFloatingGroupedWithProratedMinimumPrice ) = - PriceCreateBody( + Body( newFloatingGroupedWithProratedMinimumPrice = newFloatingGroupedWithProratedMinimumPrice ) @@ -776,7 +853,7 @@ private constructor( fun ofNewFloatingGroupedWithMeteredMinimumPrice( newFloatingGroupedWithMeteredMinimumPrice: NewFloatingGroupedWithMeteredMinimumPrice ) = - PriceCreateBody( + Body( newFloatingGroupedWithMeteredMinimumPrice = newFloatingGroupedWithMeteredMinimumPrice ) @@ -784,33 +861,24 @@ private constructor( @JvmStatic fun ofNewFloatingMatrixWithDisplayNamePrice( newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice - ) = - PriceCreateBody( - newFloatingMatrixWithDisplayNamePrice = newFloatingMatrixWithDisplayNamePrice - ) + ) = Body(newFloatingMatrixWithDisplayNamePrice = newFloatingMatrixWithDisplayNamePrice) @JvmStatic fun ofNewFloatingBulkWithProrationPrice( newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice - ) = - PriceCreateBody( - newFloatingBulkWithProrationPrice = newFloatingBulkWithProrationPrice - ) + ) = Body(newFloatingBulkWithProrationPrice = newFloatingBulkWithProrationPrice) @JvmStatic fun ofNewFloatingGroupedTieredPackagePrice( newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice - ) = - PriceCreateBody( - newFloatingGroupedTieredPackagePrice = newFloatingGroupedTieredPackagePrice - ) + ) = Body(newFloatingGroupedTieredPackagePrice = newFloatingGroupedTieredPackagePrice) @JvmStatic fun ofNewFloatingScalableMatrixWithUnitPricingPrice( newFloatingScalableMatrixWithUnitPricingPrice: NewFloatingScalableMatrixWithUnitPricingPrice ) = - PriceCreateBody( + Body( newFloatingScalableMatrixWithUnitPricingPrice = newFloatingScalableMatrixWithUnitPricingPrice ) @@ -820,7 +888,7 @@ private constructor( newFloatingScalableMatrixWithTieredPricingPrice: NewFloatingScalableMatrixWithTieredPricingPrice ) = - PriceCreateBody( + Body( newFloatingScalableMatrixWithTieredPricingPrice = newFloatingScalableMatrixWithTieredPricingPrice ) @@ -828,16 +896,10 @@ private constructor( @JvmStatic fun ofNewFloatingCumulativeGroupedBulkPrice( newFloatingCumulativeGroupedBulkPrice: NewFloatingCumulativeGroupedBulkPrice - ) = - PriceCreateBody( - newFloatingCumulativeGroupedBulkPrice = newFloatingCumulativeGroupedBulkPrice - ) + ) = Body(newFloatingCumulativeGroupedBulkPrice = newFloatingCumulativeGroupedBulkPrice) } - /** - * An interface that defines how to map each variant of [PriceCreateBody] to a value of type - * [T]. - */ + /** An interface that defines how to map each variant of [Body] to a value of type [T]. */ interface Visitor { fun visitNewFloatingUnitPrice(newFloatingUnitPrice: NewFloatingUnitPrice): T @@ -942,279 +1004,329 @@ private constructor( ): T /** - * Maps an unknown variant of [PriceCreateBody] to a value of type [T]. + * Maps an unknown variant of [Body] to a value of type [T]. * - * An instance of [PriceCreateBody] can contain an unknown variant if it was - * deserialized from data that doesn't match any known variant. For example, if the SDK - * is on an older version than the API, then the API may respond with new variants that - * the SDK is unaware of. + * An instance of [Body] can contain an unknown variant if it was deserialized from data + * that doesn't match any known variant. For example, if the SDK is on an older version + * than the API, then the API may respond with new variants that the SDK is unaware of. * * @throws OrbInvalidDataException in the default implementation. */ fun unknown(json: JsonValue?): T { - throw OrbInvalidDataException("Unknown PriceCreateBody: $json") + throw OrbInvalidDataException("Unknown Body: $json") } } - internal class Deserializer : BaseDeserializer(PriceCreateBody::class) { + internal class Deserializer : BaseDeserializer(Body::class) { - override fun ObjectCodec.deserialize(node: JsonNode): PriceCreateBody { + override fun ObjectCodec.deserialize(node: JsonNode): Body { val json = JsonValue.fromJsonNode(node) val modelType = json.asObject().getOrNull()?.get("model_type")?.asString()?.getOrNull() when (modelType) { "unit" -> { - tryDeserialize(node, jacksonTypeRef())?.let { - return PriceCreateBody(newFloatingUnitPrice = it, _json = json) - } + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Body(newFloatingUnitPrice = it, _json = json) + } } "package" -> { - tryDeserialize(node, jacksonTypeRef())?.let { - return PriceCreateBody(newFloatingPackagePrice = it, _json = json) - } + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Body(newFloatingPackagePrice = it, _json = json) + } } "matrix" -> { - tryDeserialize(node, jacksonTypeRef())?.let { - return PriceCreateBody(newFloatingMatrixPrice = it, _json = json) - } + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Body(newFloatingMatrixPrice = it, _json = json) + } } "matrix_with_allocation" -> { - tryDeserialize(node, jacksonTypeRef()) + tryDeserialize( + node, + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( - newFloatingMatrixWithAllocationPrice = it, - _json = json - ) + return Body(newFloatingMatrixWithAllocationPrice = it, _json = json) } } "tiered" -> { - tryDeserialize(node, jacksonTypeRef())?.let { - return PriceCreateBody(newFloatingTieredPrice = it, _json = json) - } + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Body(newFloatingTieredPrice = it, _json = json) + } } "tiered_bps" -> { - tryDeserialize(node, jacksonTypeRef())?.let { - return PriceCreateBody(newFloatingTieredBpsPrice = it, _json = json) - } + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Body(newFloatingTieredBpsPrice = it, _json = json) + } } "bps" -> { - tryDeserialize(node, jacksonTypeRef())?.let { - return PriceCreateBody(newFloatingBpsPrice = it, _json = json) - } + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Body(newFloatingBpsPrice = it, _json = json) + } } "bulk_bps" -> { - tryDeserialize(node, jacksonTypeRef())?.let { - return PriceCreateBody(newFloatingBulkBpsPrice = it, _json = json) - } + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Body(newFloatingBulkBpsPrice = it, _json = json) + } } "bulk" -> { - tryDeserialize(node, jacksonTypeRef())?.let { - return PriceCreateBody(newFloatingBulkPrice = it, _json = json) - } + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Body(newFloatingBulkPrice = it, _json = json) + } } "threshold_total_amount" -> { - tryDeserialize(node, jacksonTypeRef()) + tryDeserialize( + node, + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( - newFloatingThresholdTotalAmountPrice = it, - _json = json - ) + return Body(newFloatingThresholdTotalAmountPrice = it, _json = json) } } "tiered_package" -> { - tryDeserialize(node, jacksonTypeRef())?.let { - return PriceCreateBody(newFloatingTieredPackagePrice = it, _json = json) - } + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Body(newFloatingTieredPackagePrice = it, _json = json) + } } "grouped_tiered" -> { - tryDeserialize(node, jacksonTypeRef())?.let { - return PriceCreateBody(newFloatingGroupedTieredPrice = it, _json = json) - } + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Body(newFloatingGroupedTieredPrice = it, _json = json) + } } "max_group_tiered_package" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( + return Body( newFloatingMaxGroupTieredPackagePrice = it, - _json = json + _json = json, ) } } "tiered_with_minimum" -> { - tryDeserialize(node, jacksonTypeRef()) + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } ?.let { - return PriceCreateBody( - newFloatingTieredWithMinimumPrice = it, - _json = json - ) + return Body(newFloatingTieredWithMinimumPrice = it, _json = json) } } "package_with_allocation" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( + return Body( newFloatingPackageWithAllocationPrice = it, - _json = json + _json = json, ) } } "tiered_package_with_minimum" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( + return Body( newFloatingTieredPackageWithMinimumPrice = it, - _json = json + _json = json, ) } } "unit_with_percent" -> { - tryDeserialize(node, jacksonTypeRef()) + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } ?.let { - return PriceCreateBody( - newFloatingUnitWithPercentPrice = it, - _json = json - ) + return Body(newFloatingUnitWithPercentPrice = it, _json = json) } } "tiered_with_proration" -> { - tryDeserialize(node, jacksonTypeRef()) + tryDeserialize( + node, + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( - newFloatingTieredWithProrationPrice = it, - _json = json - ) + return Body(newFloatingTieredWithProrationPrice = it, _json = json) } } "unit_with_proration" -> { - tryDeserialize(node, jacksonTypeRef()) + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } ?.let { - return PriceCreateBody( - newFloatingUnitWithProrationPrice = it, - _json = json - ) + return Body(newFloatingUnitWithProrationPrice = it, _json = json) } } "grouped_allocation" -> { - tryDeserialize(node, jacksonTypeRef()) + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } ?.let { - return PriceCreateBody( - newFloatingGroupedAllocationPrice = it, - _json = json - ) + return Body(newFloatingGroupedAllocationPrice = it, _json = json) } } "grouped_with_prorated_minimum" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( + return Body( newFloatingGroupedWithProratedMinimumPrice = it, - _json = json + _json = json, ) } } "grouped_with_metered_minimum" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( + return Body( newFloatingGroupedWithMeteredMinimumPrice = it, - _json = json + _json = json, ) } } "matrix_with_display_name" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( + return Body( newFloatingMatrixWithDisplayNamePrice = it, - _json = json + _json = json, ) } } "bulk_with_proration" -> { - tryDeserialize(node, jacksonTypeRef()) + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } ?.let { - return PriceCreateBody( - newFloatingBulkWithProrationPrice = it, - _json = json - ) + return Body(newFloatingBulkWithProrationPrice = it, _json = json) } } "grouped_tiered_package" -> { - tryDeserialize(node, jacksonTypeRef()) + tryDeserialize( + node, + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( - newFloatingGroupedTieredPackagePrice = it, - _json = json - ) + return Body(newFloatingGroupedTieredPackagePrice = it, _json = json) } } "scalable_matrix_with_unit_pricing" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( + return Body( newFloatingScalableMatrixWithUnitPricingPrice = it, - _json = json + _json = json, ) } } "scalable_matrix_with_tiered_pricing" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( + return Body( newFloatingScalableMatrixWithTieredPricingPrice = it, - _json = json + _json = json, ) } } "cumulative_grouped_bulk" -> { tryDeserialize( node, - jacksonTypeRef() - ) + jacksonTypeRef(), + ) { + it.validate() + } ?.let { - return PriceCreateBody( + return Body( newFloatingCumulativeGroupedBulkPrice = it, - _json = json + _json = json, ) } } } - return PriceCreateBody(_json = json) + return Body(_json = json) } } - internal class Serializer : BaseSerializer(PriceCreateBody::class) { + internal class Serializer : BaseSerializer(Body::class) { override fun serialize( - value: PriceCreateBody, + value: Body, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newFloatingUnitPrice != null -> @@ -1274,1274 +1386,529 @@ private constructor( value.newFloatingCumulativeGroupedBulkPrice != null -> generator.writeObject(value.newFloatingCumulativeGroupedBulkPrice) value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid PriceCreateBody") + else -> throw IllegalStateException("Invalid Body") } } } - } - fun toBuilder() = Builder().from(this) + @NoAutoDetect + class NewFloatingUnitPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("unit_config") + @ExcludeMissing + private val unitConfig: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - companion object { + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") - @JvmStatic fun builder() = Builder() - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") - /** A builder for [PriceCreateParams]. */ - @NoAutoDetect - class Builder internal constructor() { + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") - private var body: PriceCreateBody? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + fun modelType(): ModelType = modelType.getRequired("model_type") - @JvmSynthetic - internal fun from(priceCreateParams: PriceCreateParams) = apply { - body = priceCreateParams.body - additionalHeaders = priceCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = priceCreateParams.additionalQueryParams.toBuilder() - } + /** The name of the price. */ + fun name(): String = name.getRequired("name") - fun forNewFloatingUnitPrice(newFloatingUnitPrice: NewFloatingUnitPrice) = apply { - body = PriceCreateBody.ofNewFloatingUnitPrice(newFloatingUnitPrice) - } + fun unitConfig(): UnitConfig = unitConfig.getRequired("unit_config") - fun forNewFloatingPackagePrice(newFloatingPackagePrice: NewFloatingPackagePrice) = apply { - body = PriceCreateBody.ofNewFloatingPackagePrice(newFloatingPackagePrice) - } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - fun forNewFloatingMatrixPrice(newFloatingMatrixPrice: NewFloatingMatrixPrice) = apply { - body = PriceCreateBody.ofNewFloatingMatrixPrice(newFloatingMatrixPrice) - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - fun forNewFloatingMatrixWithAllocationPrice( - newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingMatrixWithAllocationPrice( - newFloatingMatrixWithAllocationPrice - ) - } - - fun forNewFloatingTieredPrice(newFloatingTieredPrice: NewFloatingTieredPrice) = apply { - body = PriceCreateBody.ofNewFloatingTieredPrice(newFloatingTieredPrice) - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - fun forNewFloatingTieredBpsPrice(newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice) = - apply { - body = PriceCreateBody.ofNewFloatingTieredBpsPrice(newFloatingTieredBpsPrice) - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun forNewFloatingBpsPrice(newFloatingBpsPrice: NewFloatingBpsPrice) = apply { - body = PriceCreateBody.ofNewFloatingBpsPrice(newFloatingBpsPrice) - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun forNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice) = apply { - body = PriceCreateBody.ofNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun forNewFloatingBulkPrice(newFloatingBulkPrice: NewFloatingBulkPrice) = apply { - body = PriceCreateBody.ofNewFloatingBulkPrice(newFloatingBulkPrice) - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - fun forNewFloatingThresholdTotalAmountPrice( - newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingThresholdTotalAmountPrice( - newFloatingThresholdTotalAmountPrice + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") ) - } - fun forNewFloatingTieredPackagePrice( - newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice - ) = apply { - body = PriceCreateBody.ofNewFloatingTieredPackagePrice(newFloatingTieredPackagePrice) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - fun forNewFloatingGroupedTieredPrice( - newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice - ) = apply { - body = PriceCreateBody.ofNewFloatingGroupedTieredPrice(newFloatingGroupedTieredPrice) - } + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - fun forNewFloatingMaxGroupTieredPackagePrice( - newFloatingMaxGroupTieredPackagePrice: NewFloatingMaxGroupTieredPackagePrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingMaxGroupTieredPackagePrice( - newFloatingMaxGroupTieredPackagePrice - ) - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - fun forNewFloatingTieredWithMinimumPrice( - newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingTieredWithMinimumPrice( - newFloatingTieredWithMinimumPrice - ) - } + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - fun forNewFloatingPackageWithAllocationPrice( - newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingPackageWithAllocationPrice( - newFloatingPackageWithAllocationPrice - ) - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - fun forNewFloatingTieredPackageWithMinimumPrice( - newFloatingTieredPackageWithMinimumPrice: NewFloatingTieredPackageWithMinimumPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingTieredPackageWithMinimumPrice( - newFloatingTieredPackageWithMinimumPrice - ) - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - fun forNewFloatingUnitWithPercentPrice( - newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingUnitWithPercentPrice(newFloatingUnitWithPercentPrice) - } + @JsonProperty("unit_config") + @ExcludeMissing + fun _unitConfig(): JsonField = unitConfig - fun forNewFloatingTieredWithProrationPrice( - newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingTieredWithProrationPrice( - newFloatingTieredWithProrationPrice - ) - } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId - fun forNewFloatingUnitWithProrationPrice( - newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingUnitWithProrationPrice( - newFloatingUnitWithProrationPrice - ) - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance - fun forNewFloatingGroupedAllocationPrice( - newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingGroupedAllocationPrice( - newFloatingGroupedAllocationPrice - ) - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - fun forNewFloatingGroupedWithProratedMinimumPrice( - newFloatingGroupedWithProratedMinimumPrice: NewFloatingGroupedWithProratedMinimumPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingGroupedWithProratedMinimumPrice( - newFloatingGroupedWithProratedMinimumPrice - ) - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - fun forNewFloatingGroupedWithMeteredMinimumPrice( - newFloatingGroupedWithMeteredMinimumPrice: NewFloatingGroupedWithMeteredMinimumPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingGroupedWithMeteredMinimumPrice( - newFloatingGroupedWithMeteredMinimumPrice - ) - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId - fun forNewFloatingMatrixWithDisplayNamePrice( - newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingMatrixWithDisplayNamePrice( - newFloatingMatrixWithDisplayNamePrice - ) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - fun forNewFloatingBulkWithProrationPrice( - newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingBulkWithProrationPrice( - newFloatingBulkWithProrationPrice - ) - } + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - fun forNewFloatingGroupedTieredPackagePrice( - newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingGroupedTieredPackagePrice( - newFloatingGroupedTieredPackagePrice - ) - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration - fun forNewFloatingScalableMatrixWithUnitPricingPrice( - newFloatingScalableMatrixWithUnitPricingPrice: - NewFloatingScalableMatrixWithUnitPricingPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingScalableMatrixWithUnitPricingPrice( - newFloatingScalableMatrixWithUnitPricingPrice - ) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - fun forNewFloatingScalableMatrixWithTieredPricingPrice( - newFloatingScalableMatrixWithTieredPricingPrice: - NewFloatingScalableMatrixWithTieredPricingPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingScalableMatrixWithTieredPricingPrice( - newFloatingScalableMatrixWithTieredPricingPrice - ) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun forNewFloatingCumulativeGroupedBulkPrice( - newFloatingCumulativeGroupedBulkPrice: NewFloatingCumulativeGroupedBulkPrice - ) = apply { - body = - PriceCreateBody.ofNewFloatingCumulativeGroupedBulkPrice( - newFloatingCumulativeGroupedBulkPrice - ) - } + private var validated: Boolean = false - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + fun validate(): NewFloatingUnitPrice = apply { + if (validated) { + return@apply + } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + cadence() + currency() + itemId() + modelType() + name() + unitConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true + } - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } + fun toBuilder() = Builder().from(this) - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } + companion object { - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + @JvmStatic fun builder() = Builder() + } - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + /** A builder for [NewFloatingUnitPrice]. */ + class Builder internal constructor() { - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var unitConfig: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } + @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() + } - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } + fun unitConfig(unitConfig: UnitConfig) = unitConfig(JsonField.of(unitConfig)) - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + fun unitConfig(unitConfig: JsonField) = apply { + this.unitConfig = unitConfig + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - fun build(): PriceCreateParams = - PriceCreateParams( - body ?: PriceCreateBody(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - @NoAutoDetect - class NewFloatingUnitPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("unit_config") - @ExcludeMissing - private val unitConfig: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - fun modelType(): ModelType = modelType.getRequired("model_type") + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - fun unitConfig(): UnitConfig = unitConfig.getRequired("unit_config") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("unit_config") - @ExcludeMissing - fun _unitConfig(): JsonField = unitConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - private var validated: Boolean = false + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - fun validate(): NewFloatingUnitPrice = apply { - if (validated) { - return@apply - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - cadence() - currency() - itemId() - modelType() - name() - unitConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - fun toBuilder() = Builder().from(this) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - companion object { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - @JvmStatic fun builder() = Builder() - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - /** A builder for [NewFloatingUnitPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var unitConfig: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - - /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - fun unitConfig(unitConfig: UnitConfig) = unitConfig(JsonField.of(unitConfig)) - - fun unitConfig(unitConfig: JsonField) = apply { - this.unitConfig = unitConfig - } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } - - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) - - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): NewFloatingUnitPrice = - NewFloatingUnitPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired("unitConfig", unitConfig), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } - - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ANNUAL = of("annual") - - @JvmField val SEMI_ANNUAL = of("semi_annual") - - @JvmField val MONTHLY = of("monthly") - - @JvmField val QUARTERLY = of("quarterly") - - @JvmField val ONE_TIME = of("one_time") - - @JvmField val CUSTOM = of("custom") - - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } - - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } - - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - 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") - } - - fun asString(): String = _value().asStringOrThrow() - - 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() - } - - @NoAutoDetect - class UnitConfig - @JsonCreator - private constructor( - @JsonProperty("unit_amount") - @ExcludeMissing - private val unitAmount: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** Rate per unit of usage */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") - - /** Rate per unit of usage */ - @JsonProperty("unit_amount") - @ExcludeMissing - fun _unitAmount(): JsonField = unitAmount - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): UnitConfig = apply { - if (validated) { - return@apply - } - - unitAmount() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [UnitConfig]. */ - class Builder internal constructor() { - - private var unitAmount: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(unitConfig: UnitConfig) = apply { - unitAmount = unitConfig.unitAmount - additionalProperties = unitConfig.additionalProperties.toMutableMap() - } - - /** Rate per unit of usage */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - - /** Rate per unit of usage */ - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): UnitConfig = - UnitConfig( - checkRequired("unitAmount", unitAmount), - additionalProperties.toImmutable() - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is UnitConfig && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "UnitConfig{unitAmount=$unitAmount, additionalProperties=$additionalProperties}" - } - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") - - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration - - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply - } - - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @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() + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2565,20 +1932,30 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), + fun build(): NewFloatingUnitPrice = + NewFloatingUnitPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired("unitConfig", unitConfig), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2592,35 +1969,50 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val MONTHLY = of("monthly") + + @JvmField val QUARTERLY = of("quarterly") - @JvmField val MONTH = of("month") + @JvmField val ONE_TIME = of("one_time") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [Cadence]'s known values. */ enum class Known { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * An instance of [Cadence] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -2634,8 +2026,12 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM else -> Value._UNKNOWN } @@ -2650,9 +2046,13 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") } fun asString(): String = _value().asStringOrThrow() @@ -2662,7 +2062,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -2670,146 +2070,8 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") - - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration - - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply - } - - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { - - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() - } - - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } - - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2823,35 +2085,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val UNIT = of("unit") - @JvmField val MONTH = of("month") - - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + UNIT } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + UNIT, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -2865,8 +2122,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + UNIT -> Value.UNIT else -> Value._UNKNOWN } @@ -2881,9 +2137,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + UNIT -> Known.UNIT + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -2893,7 +2148,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -2901,1039 +2156,892 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + @NoAutoDetect + class UnitConfig + @JsonCreator + private constructor( + @JsonProperty("unit_amount") + @ExcludeMissing + private val unitAmount: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** Rate per unit of usage */ + fun unitAmount(): String = unitAmount.getRequired("unit_amount") - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** Rate per unit of usage */ + @JsonProperty("unit_amount") + @ExcludeMissing + fun _unitAmount(): JsonField = unitAmount - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun validate(): UnitConfig = apply { + if (validated) { + return@apply + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + unitAmount() + validated = true + } - private var validated: Boolean = false + fun toBuilder() = Builder().from(this) - fun validate(): Metadata = apply { - if (validated) { - return@apply + companion object { + + @JvmStatic fun builder() = Builder() } - validated = true - } + /** A builder for [UnitConfig]. */ + class Builder internal constructor() { - fun toBuilder() = Builder().from(this) + private var unitAmount: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(unitConfig: UnitConfig) = apply { + unitAmount = unitConfig.unitAmount + additionalProperties = unitConfig.additionalProperties.toMutableMap() + } - @JvmStatic fun builder() = Builder() - } + /** Rate per unit of usage */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** Rate per unit of usage */ + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount + } - private var additionalProperties: MutableMap = mutableMapOf() + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + fun build(): UnitConfig = + UnitConfig( + checkRequired("unitAmount", unitAmount), + additionalProperties.toImmutable(), + ) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is UnitConfig && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(unitAmount, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "UnitConfig{unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - override fun hashCode(): Int = hashCode + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - 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 */ - } + private var validated: Boolean = false - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, unitConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } - override fun hashCode(): Int = hashCode + duration() + durationUnit() + validated = true + } - 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}" - } + fun toBuilder() = Builder().from(this) - @NoAutoDetect - class NewFloatingPackagePrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("package_config") - @ExcludeMissing - private val packageConfig: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + @JvmStatic fun builder() = Builder() + } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - fun modelType(): ModelType = modelType.getRequired("model_type") + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - fun packageConfig(): PackageConfig = packageConfig.getRequired("package_config") + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("package_config") - @ExcludeMissing - fun _packageConfig(): JsonField = packageConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - private var validated: Boolean = false + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun validate(): NewFloatingPackagePrice = apply { - if (validated) { - return@apply - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - cadence() - currency() - itemId() - modelType() - name() - packageConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } - fun toBuilder() = Builder().from(this) + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - companion object { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - @JvmStatic fun builder() = Builder() - } + companion object { - /** A builder for [NewFloatingPackagePrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var packageConfig: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + @JvmField val DAY = of("day") - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @JvmField val MONTH = of("month") - /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun asString(): String = _value().asStringOrThrow() - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } + override fun hashCode() = value.hashCode() - fun packageConfig(packageConfig: PackageConfig) = - packageConfig(JsonField.of(packageConfig)) + override fun toString() = value.toString() + } - fun packageConfig(packageConfig: JsonField) = apply { - this.packageConfig = packageConfig - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + private var validated: Boolean = false - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + duration() + durationUnit() + validated = true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + fun toBuilder() = Builder().from(this) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + companion object { - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + @JvmStatic fun builder() = Builder() + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + /** The unit of billing period duration. */ + class DurationUnit + @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`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the 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 additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + companion object { - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + @JvmField val DAY = of("day") - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - fun build(): NewFloatingPackagePrice = - NewFloatingPackagePrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired("packageConfig", packageConfig), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the 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 asString(): String = _value().asStringOrThrow() - companion object { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val ANNUAL = of("annual") + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - @JvmField val SEMI_ANNUAL = of("semi_annual") + override fun hashCode() = value.hashCode() - @JvmField val MONTHLY = of("monthly") + override fun toString() = value.toString() + } - @JvmField val QUARTERLY = of("quarterly") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val ONE_TIME = of("one_time") + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } - @JvmField val CUSTOM = of("custom") + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + override fun hashCode(): Int = hashCode - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = 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) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + private var validated: Boolean = false - fun asString(): String = _value().asStringOrThrow() + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + validated = true } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - override fun hashCode() = value.hashCode() + companion object { - override fun toString() = value.toString() - } + @JvmStatic fun builder() = Builder() + } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - @JvmField val PACKAGE = of("package") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE, - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * 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, - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } 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 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 */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, unitConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - override fun toString() = value.toString() + 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}" } @NoAutoDetect - class PackageConfig + class NewFloatingPackagePrice @JsonCreator private constructor( - @JsonProperty("package_amount") + @JsonProperty("cadence") @ExcludeMissing - private val packageAmount: JsonField = JsonMissing.of(), - @JsonProperty("package_size") + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing - private val packageSize: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** A currency amount to rate usage by */ - fun packageAmount(): String = packageAmount.getRequired("package_amount") - - /** - * An integer amount to represent package size. For example, 1000 here would divide - * usage by 1000 before multiplying by package_amount in rating - */ - fun packageSize(): Long = packageSize.getRequired("package_size") - - /** A currency amount to rate usage by */ - @JsonProperty("package_amount") + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") @ExcludeMissing - fun _packageAmount(): JsonField = packageAmount - - /** - * An integer amount to represent package size. For example, 1000 here would divide - * usage by 1000 before multiplying by package_amount in rating - */ - @JsonProperty("package_size") + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") @ExcludeMissing - fun _packageSize(): JsonField = packageSize - - @JsonAnyGetter + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private val name: JsonField = JsonMissing.of(), + @JsonProperty("package_config") + @ExcludeMissing + private val packageConfig: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - private var validated: Boolean = false + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") - fun validate(): PackageConfig = apply { - if (validated) { - return@apply - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") - packageAmount() - packageSize() - validated = true - } + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") - fun toBuilder() = Builder().from(this) + fun modelType(): ModelType = modelType.getRequired("model_type") - companion object { + /** The name of the price. */ + fun name(): String = name.getRequired("name") - @JvmStatic fun builder() = Builder() - } + fun packageConfig(): PackageConfig = packageConfig.getRequired("package_config") - /** A builder for [PackageConfig]. */ - class Builder internal constructor() { + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - private var packageAmount: JsonField? = null - private var packageSize: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - @JvmSynthetic - internal fun from(packageConfig: PackageConfig) = apply { - packageAmount = packageConfig.packageAmount - packageSize = packageConfig.packageSize - additionalProperties = packageConfig.additionalProperties.toMutableMap() - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** A currency amount to rate usage by */ - fun packageAmount(packageAmount: String) = - packageAmount(JsonField.of(packageAmount)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** A currency amount to rate usage by */ - fun packageAmount(packageAmount: JsonField) = apply { - this.packageAmount = packageAmount - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - /** - * An integer amount to represent package size. For example, 1000 here would divide - * usage by 1000 before multiplying by package_amount in rating - */ - fun packageSize(packageSize: Long) = packageSize(JsonField.of(packageSize)) + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - /** - * An integer amount to represent package size. For example, 1000 here would divide - * usage by 1000 before multiplying by package_amount in rating - */ - fun packageSize(packageSize: JsonField) = apply { - this.packageSize = packageSize - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - fun build(): PackageConfig = - PackageConfig( - checkRequired("packageAmount", packageAmount), - checkRequired("packageSize", packageSize), - additionalProperties.toImmutable(), - ) - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - return /* spotless:off */ other is PackageConfig && packageAmount == other.packageAmount && packageSize == other.packageSize && additionalProperties == other.additionalProperties /* spotless:on */ - } + @JsonProperty("package_config") + @ExcludeMissing + fun _packageConfig(): JsonField = packageConfig - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(packageAmount, packageSize, additionalProperties) } - /* spotless:on */ + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId - override fun hashCode(): Int = hashCode + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance - override fun toString() = - "PackageConfig{packageAmount=$packageAmount, packageSize=$packageSize, additionalProperties=$additionalProperties}" - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") + fun _conversionRate(): JsonField = conversionRate + + /** An alias for the price. */ + @JsonProperty("external_price_id") @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun _externalPriceId(): JsonField = externalPriceId - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -3941,13 +3049,26 @@ private constructor( private var validated: Boolean = false - fun validate(): BillingCycleConfiguration = apply { + fun validate(): NewFloatingPackagePrice = apply { if (validated) { return@apply } - duration() - durationUnit() + cadence() + currency() + itemId() + modelType() + name() + packageConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } validated = true } @@ -3958,266 +3079,281 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [BillingCycleConfiguration]. */ + /** A builder for [NewFloatingPackagePrice]. */ class Builder internal constructor() { - private var duration: JsonField? = null - private var durationUnit: JsonField? = null + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var packageConfig: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit + 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 = - billingCycleConfiguration.additionalProperties.toMutableMap() + newFloatingPackagePrice.additionalProperties.toMutableMap() } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + fun packageConfig(packageConfig: PackageConfig) = + packageConfig(JsonField.of(packageConfig)) + + fun packageConfig(packageConfig: JsonField) = apply { + this.packageConfig = packageConfig + } /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. + * The id of the billable metric for the price. Only needed if the price is + * usage-based. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } - - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * The id of the billable metric for the price. Only needed if the price is + * usage-based. */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") - } - - fun asString(): String = _value().asStringOrThrow() + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - override fun hashCode(): Int = hashCode + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - private var validated: Boolean = false + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - @JvmStatic fun builder() = Builder() - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -4241,20 +3377,30 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), + fun build(): NewFloatingPackagePrice = + NewFloatingPackagePrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired("packageConfig", packageConfig), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -4268,35 +3414,50 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val MONTHLY = of("monthly") + + @JvmField val QUARTERLY = of("quarterly") + + @JvmField val ONE_TIME = of("one_time") - @JvmField val MONTH = of("month") + @JvmField val CUSTOM = of("custom") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [Cadence]'s known values. */ enum class Known { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * An instance of [Cadence] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -4310,8 +3471,12 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM else -> Value._UNKNOWN } @@ -4326,9 +3491,13 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") } fun asString(): String = _value().asStringOrThrow() @@ -4338,7 +3507,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -4346,999 +3515,725 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { - @JvmStatic fun builder() = Builder() - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** A builder for [Metadata]. */ - class Builder internal constructor() { + companion object { - private var additionalProperties: MutableMap = mutableMapOf() + @JvmField val PACKAGE = of("package") - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + /** An enum containing [ModelType]'s known values. */ + enum class Known { + PACKAGE } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * 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, } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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 } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to 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") + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun asString(): String = _value().asStringOrThrow() - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + 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 ModelType && value == other.value /* spotless:on */ } - return /* spotless:off */ other is Metadata && 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 + @NoAutoDetect + class PackageConfig + @JsonCreator + private constructor( + @JsonProperty("package_amount") + @ExcludeMissing + private val packageAmount: JsonField = JsonMissing.of(), + @JsonProperty("package_size") + @ExcludeMissing + private val packageSize: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + /** A currency amount to rate usage by */ + fun packageAmount(): String = packageAmount.getRequired("package_amount") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * An integer amount to represent package size. For example, 1000 here would divide + * usage by 1000 before multiplying by package_amount in rating + */ + fun packageSize(): Long = packageSize.getRequired("package_size") - 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 */ - } + /** A currency amount to rate usage by */ + @JsonProperty("package_amount") + @ExcludeMissing + fun _packageAmount(): JsonField = packageAmount - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, packageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + /** + * An integer amount to represent package size. For example, 1000 here would divide + * usage by 1000 before multiplying by package_amount in rating + */ + @JsonProperty("package_size") + @ExcludeMissing + fun _packageSize(): JsonField = packageSize - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - 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}" - } + private var validated: Boolean = false - @NoAutoDetect - class NewFloatingMatrixPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("matrix_config") - @ExcludeMissing - private val matrixConfig: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun validate(): PackageConfig = apply { + if (validated) { + return@apply + } - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + packageAmount() + packageSize() + validated = true + } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + fun toBuilder() = Builder().from(this) - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + companion object { - fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") + @JvmStatic fun builder() = Builder() + } - fun modelType(): ModelType = modelType.getRequired("model_type") + /** A builder for [PackageConfig]. */ + class Builder internal constructor() { - /** The name of the price. */ - fun name(): String = name.getRequired("name") + private var packageAmount: JsonField? = null + private var packageSize: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + @JvmSynthetic + internal fun from(packageConfig: PackageConfig) = apply { + packageAmount = packageConfig.packageAmount + packageSize = packageConfig.packageSize + additionalProperties = packageConfig.additionalProperties.toMutableMap() + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + /** A currency amount to rate usage by */ + fun packageAmount(packageAmount: String) = + packageAmount(JsonField.of(packageAmount)) - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + /** A currency amount to rate usage by */ + fun packageAmount(packageAmount: JsonField) = apply { + this.packageAmount = packageAmount + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + /** + * An integer amount to represent package size. For example, 1000 here would + * divide usage by 1000 before multiplying by package_amount in rating + */ + fun packageSize(packageSize: Long) = packageSize(JsonField.of(packageSize)) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("matrix_config") - @ExcludeMissing - fun _matrixConfig(): JsonField = matrixConfig - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** + * An integer amount to represent package size. For example, 1000 here would + * divide usage by 1000 before multiplying by package_amount in rating + */ + fun packageSize(packageSize: JsonField) = apply { + this.packageSize = packageSize + } - private var validated: Boolean = false + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun validate(): NewFloatingMatrixPrice = apply { - if (validated) { - return@apply - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - cadence() - currency() - itemId() - matrixConfig().validate() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun toBuilder() = Builder().from(this) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - companion object { + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - @JvmStatic fun builder() = Builder() - } + fun build(): PackageConfig = + PackageConfig( + checkRequired("packageAmount", packageAmount), + checkRequired("packageSize", packageSize), + additionalProperties.toImmutable(), + ) + } - /** A builder for [NewFloatingMatrixPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var matrixConfig: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + return /* spotless:off */ other is PackageConfig && packageAmount == other.packageAmount && packageSize == other.packageSize && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(packageAmount, packageSize, additionalProperties) } + /* spotless:on */ - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + override fun hashCode(): Int = hashCode - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + override fun toString() = + "PackageConfig{packageAmount=$packageAmount, packageSize=$packageSize, additionalProperties=$additionalProperties}" + } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - fun matrixConfig(matrixConfig: MatrixConfig) = matrixConfig(JsonField.of(matrixConfig)) + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - fun matrixConfig(matrixConfig: JsonField) = apply { - this.matrixConfig = matrixConfig - } + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + private var validated: Boolean = false - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + duration() + durationUnit() + validated = true + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun toBuilder() = Builder().from(this) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + companion object { - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + @JvmStatic fun builder() = Builder() + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + companion object { - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + @JvmField val DAY = of("day") - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + @JvmField val MONTH = of("month") - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + fun asString(): String = _value().asStringOrThrow() - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + override fun toString() = value.toString() + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): NewFloatingMatrixPrice = - NewFloatingMatrixPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("matrixConfig", matrixConfig), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + override fun hashCode(): Int = hashCode - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$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. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ANNUAL = of("annual") - - @JvmField val SEMI_ANNUAL = of("semi_annual") + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - @JvmField val MONTHLY = of("monthly") + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - @JvmField val QUARTERLY = of("quarterly") + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - @JvmField val ONE_TIME = of("one_time") + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - @JvmField val CUSTOM = of("custom") + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + private var validated: Boolean = false - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN + duration() + durationUnit() + validated = true } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + fun toBuilder() = Builder().from(this) - fun asString(): String = _value().asStringOrThrow() + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - override fun hashCode() = value.hashCode() + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun toString() = value.toString() - } + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - @NoAutoDetect - class MatrixConfig - @JsonCreator - private constructor( - @JsonProperty("default_unit_amount") - @ExcludeMissing - private val defaultUnitAmount: JsonField = JsonMissing.of(), - @JsonProperty("dimensions") - @ExcludeMissing - private val dimensions: JsonField> = JsonMissing.of(), - @JsonProperty("matrix_values") - @ExcludeMissing - private val matrixValues: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** Default per unit rate for any usage not bucketed into a specified matrix_value */ - fun defaultUnitAmount(): String = defaultUnitAmount.getRequired("default_unit_amount") + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(): List = dimensions.getRequired("dimensions") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** Matrix values for specified matrix grouping keys */ - fun matrixValues(): List = matrixValues.getRequired("matrix_values") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** Default per unit rate for any usage not bucketed into a specified matrix_value */ - @JsonProperty("default_unit_amount") - @ExcludeMissing - fun _defaultUnitAmount(): JsonField = defaultUnitAmount + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") - @ExcludeMissing - fun _dimensions(): JsonField> = dimensions + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** Matrix values for specified matrix grouping keys */ - @JsonProperty("matrix_values") - @ExcludeMissing - fun _matrixValues(): JsonField> = matrixValues + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - private var validated: Boolean = false + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun validate(): MatrixConfig = apply { - if (validated) { - return@apply + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - defaultUnitAmount() - dimensions() - matrixValues().forEach { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** A builder for [MatrixConfig]. */ - class Builder internal constructor() { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - private var defaultUnitAmount: JsonField? = null - private var dimensions: JsonField>? = null - private var matrixValues: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() + companion object { - @JvmSynthetic - internal fun from(matrixConfig: MatrixConfig) = apply { - defaultUnitAmount = matrixConfig.defaultUnitAmount - dimensions = matrixConfig.dimensions.map { it.toMutableList() } - matrixValues = matrixConfig.matrixValues.map { it.toMutableList() } - additionalProperties = matrixConfig.additionalProperties.toMutableMap() - } + @JvmField val DAY = of("day") - /** - * Default per unit rate for any usage not bucketed into a specified matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = - defaultUnitAmount(JsonField.of(defaultUnitAmount)) + @JvmField val MONTH = of("month") - /** - * Default per unit rate for any usage not bucketed into a specified matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: JsonField) = apply { - this.defaultUnitAmount = defaultUnitAmount - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(dimensions: JsonField>) = apply { - this.dimensions = dimensions.map { it.toMutableList() } - } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** One or two event property values to evaluate matrix groups by */ - fun addDimension(dimension: String) = apply { - dimensions = - (dimensions ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(dimension) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN } - } - /** Matrix values for specified matrix grouping keys */ - fun matrixValues(matrixValues: List) = - matrixValues(JsonField.of(matrixValues)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** Matrix values for specified matrix grouping keys */ - fun matrixValues(matrixValues: JsonField>) = apply { - this.matrixValues = matrixValues.map { it.toMutableList() } - } + fun asString(): String = _value().asStringOrThrow() - /** Matrix values for specified matrix grouping keys */ - fun addMatrixValue(matrixValue: MatrixValue) = apply { - matrixValues = - (matrixValues ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(matrixValue) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): MatrixConfig = - MatrixConfig( - checkRequired("defaultUnitAmount", defaultUnitAmount), - checkRequired("dimensions", dimensions).map { it.toImmutable() }, - checkRequired("matrixValues", matrixValues).map { it.toImmutable() }, - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ @NoAutoDetect - class MatrixValue + class Metadata @JsonCreator private constructor( - @JsonProperty("dimension_values") - @ExcludeMissing - private val dimensionValues: JsonField> = JsonMissing.of(), - @JsonProperty("unit_amount") - @ExcludeMissing - private val unitAmount: JsonField = JsonMissing.of(), @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and an - * instance tier. - */ - fun dimensionValues(): List = - dimensionValues.getRequired("dimension_values") - - /** Unit price for the specified dimension_values */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and an - * instance tier. - */ - @JsonProperty("dimension_values") - @ExcludeMissing - fun _dimensionValues(): JsonField> = dimensionValues - - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") - @ExcludeMissing - fun _unitAmount(): JsonField = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): MatrixValue = apply { + fun validate(): Metadata = apply { if (validated) { return@apply } - dimensionValues() - unitAmount() validated = true } @@ -5349,61 +4244,14 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MatrixValue]. */ + /** A builder for [Metadata]. */ class Builder internal constructor() { - private var dimensionValues: JsonField>? = null - private var unitAmount: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(matrixValue: MatrixValue) = apply { - dimensionValues = matrixValue.dimensionValues.map { it.toMutableList() } - unitAmount = matrixValue.unitAmount - additionalProperties = matrixValue.additionalProperties.toMutableMap() - } - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and - * an instance tier. - */ - fun dimensionValues(dimensionValues: List) = - dimensionValues(JsonField.of(dimensionValues)) - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and - * an instance tier. - */ - fun dimensionValues(dimensionValues: JsonField>) = apply { - this.dimensionValues = dimensionValues.map { it.toMutableList() } - } - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and - * an instance tier. - */ - fun addDimensionValue(dimensionValue: String) = apply { - dimensionValues = - (dimensionValues ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(dimensionValue) - } - } - - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() } fun additionalProperties(additionalProperties: Map) = apply { @@ -5428,14 +4276,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): MatrixValue = - MatrixValue( - checkRequired("dimensionValues", dimensionValues).map { - it.toImmutable() - }, - checkRequired("unitAmount", unitAmount), - additionalProperties.toImmutable(), - ) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -5443,17 +4284,16 @@ private constructor( return true } - return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode - override fun toString() = - "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5461,189 +4301,539 @@ private constructor( return true } - return /* spotless:off */ other is MatrixConfig && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingPackagePrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(defaultUnitAmount, dimensions, matrixValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, packageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" + "NewFloatingPackagePrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, packageConfig=$packageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - class ModelType + @NoAutoDetect + class NewFloatingMatrixPrice @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("matrix_config") + @ExcludeMissing + private val matrixConfig: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") + + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") + + fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") + + fun modelType(): ModelType = modelType.getRequired("model_type") + + /** The name of the price. */ + fun name(): String = name.getRequired("name") /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - companion object { + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - @JvmField val MATRIX = of("matrix") + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX, - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * 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. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - enum class Value { - MATRIX, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun value(): Value = - when (this) { - MATRIX -> Value.MATRIX - else -> Value._UNKNOWN - } + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun known(): Known = - when (this) { - MATRIX -> Known.MATRIX - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - fun asString(): String = _value().asStringOrThrow() + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - override fun hashCode() = value.hashCode() + @JsonProperty("matrix_config") + @ExcludeMissing + fun _matrixConfig(): JsonField = matrixConfig - override fun toString() = value.toString() - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") + fun _billableMetricId(): JsonField = billableMetricId + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun _billedInAdvance(): JsonField = billedInAdvance + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate + + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): NewFloatingMatrixPrice = apply { + if (validated) { + return@apply + } + + cadence() + currency() + itemId() + matrixConfig().validate() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NewFloatingMatrixPrice]. */ + class Builder internal constructor() { + + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var matrixConfig: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + 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() + } + + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + fun matrixConfig(matrixConfig: MatrixConfig) = + matrixConfig(JsonField.of(matrixConfig)) + + fun matrixConfig(matrixConfig: JsonField) = apply { + this.matrixConfig = matrixConfig + } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } + + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - private var validated: Boolean = false + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } - duration() - durationUnit() - validated = true - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - fun toBuilder() = Builder().from(this) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - companion object { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @JvmStatic fun builder() = Builder() - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5667,20 +4857,30 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), + fun build(): NewFloatingMatrixPrice = + NewFloatingMatrixPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("matrixConfig", matrixConfig), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5694,35 +4894,50 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") - @JvmField val MONTH = of("month") + @JvmField val MONTHLY = of("monthly") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmField val QUARTERLY = of("quarterly") + + @JvmField val ONE_TIME = of("one_time") + + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [Cadence]'s known values. */ enum class Known { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * An instance of [Cadence] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -5736,8 +4951,12 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM else -> Value._UNKNOWN } @@ -5752,9 +4971,13 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") } fun asString(): String = _value().asStringOrThrow() @@ -5764,7 +4987,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -5772,146 +4995,373 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + @NoAutoDetect + class MatrixConfig + @JsonCreator + private constructor( + @JsonProperty("default_unit_amount") + @ExcludeMissing + private val defaultUnitAmount: JsonField = JsonMissing.of(), + @JsonProperty("dimensions") + @ExcludeMissing + private val dimensions: JsonField> = JsonMissing.of(), + @JsonProperty("matrix_values") + @ExcludeMissing + private val matrixValues: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Default per unit rate for any usage not bucketed into a specified matrix_value + */ + fun defaultUnitAmount(): String = + defaultUnitAmount.getRequired("default_unit_amount") - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(): List = dimensions.getRequired("dimensions") - override fun hashCode(): Int = hashCode + /** Matrix values for specified matrix grouping keys */ + fun matrixValues(): List = matrixValues.getRequired("matrix_values") - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** + * Default per unit rate for any usage not bucketed into a specified matrix_value + */ + @JsonProperty("default_unit_amount") + @ExcludeMissing + fun _defaultUnitAmount(): JsonField = defaultUnitAmount - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") + @ExcludeMissing + fun _dimensions(): JsonField> = dimensions + + /** Matrix values for specified matrix grouping keys */ + @JsonProperty("matrix_values") + @ExcludeMissing + fun _matrixValues(): JsonField> = matrixValues - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + private var validated: Boolean = false - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + fun validate(): MatrixConfig = apply { + if (validated) { + return@apply + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + defaultUnitAmount() + dimensions() + matrixValues().forEach { it.validate() } + validated = true + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + @JvmStatic fun builder() = Builder() } - duration() - durationUnit() - validated = true - } + /** A builder for [MatrixConfig]. */ + class Builder internal constructor() { - fun toBuilder() = Builder().from(this) + private var defaultUnitAmount: JsonField? = null + private var dimensions: JsonField>? = null + private var matrixValues: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(matrixConfig: MatrixConfig) = apply { + defaultUnitAmount = matrixConfig.defaultUnitAmount + dimensions = matrixConfig.dimensions.map { it.toMutableList() } + matrixValues = matrixConfig.matrixValues.map { it.toMutableList() } + additionalProperties = matrixConfig.additionalProperties.toMutableMap() + } - @JvmStatic fun builder() = Builder() - } + /** + * Default per unit rate for any usage not bucketed into a specified + * matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: String) = + defaultUnitAmount(JsonField.of(defaultUnitAmount)) - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + /** + * Default per unit rate for any usage not bucketed into a specified + * matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: JsonField) = apply { + this.defaultUnitAmount = defaultUnitAmount + } - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(dimensions: JsonField>) = apply { + this.dimensions = dimensions.map { it.toMutableList() } } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** One or two event property values to evaluate matrix groups by */ + fun addDimension(dimension: String) = apply { + dimensions = + (dimensions ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(dimension) + } + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** Matrix values for specified matrix grouping keys */ + fun matrixValues(matrixValues: List) = + matrixValues(JsonField.of(matrixValues)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** Matrix values for specified matrix grouping keys */ + fun matrixValues(matrixValues: JsonField>) = apply { + this.matrixValues = matrixValues.map { it.toMutableList() } + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + /** Matrix values for specified matrix grouping keys */ + fun addMatrixValue(matrixValue: MatrixValue) = apply { + matrixValues = + (matrixValues ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(matrixValue) + } + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): MatrixConfig = + MatrixConfig( + checkRequired("defaultUnitAmount", defaultUnitAmount), + checkRequired("dimensions", dimensions).map { it.toImmutable() }, + checkRequired("matrixValues", matrixValues).map { it.toImmutable() }, + additionalProperties.toImmutable(), + ) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + @NoAutoDetect + class MatrixValue + @JsonCreator + private constructor( + @JsonProperty("dimension_values") + @ExcludeMissing + private val dimensionValues: JsonField> = JsonMissing.of(), + @JsonProperty("unit_amount") + @ExcludeMissing + private val unitAmount: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and + * an instance tier. + */ + fun dimensionValues(): List = + dimensionValues.getRequired("dimension_values") + + /** Unit price for the specified dimension_values */ + fun unitAmount(): String = unitAmount.getRequired("unit_amount") + + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and + * an instance tier. + */ + @JsonProperty("dimension_values") + @ExcludeMissing + fun _dimensionValues(): JsonField> = dimensionValues + + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") + @ExcludeMissing + fun _unitAmount(): JsonField = unitAmount + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): MatrixValue = apply { + if (validated) { + return@apply + } + + dimensionValues() + unitAmount() + validated = true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [MatrixValue]. */ + class Builder internal constructor() { + + private var dimensionValues: JsonField>? = null + private var unitAmount: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(matrixValue: MatrixValue) = apply { + dimensionValues = matrixValue.dimensionValues.map { it.toMutableList() } + unitAmount = matrixValue.unitAmount + additionalProperties = matrixValue.additionalProperties.toMutableMap() + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun dimensionValues(dimensionValues: List) = + dimensionValues(JsonField.of(dimensionValues)) + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun dimensionValues(dimensionValues: JsonField>) = apply { + this.dimensionValues = dimensionValues.map { it.toMutableList() } + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun addDimensionValue(dimensionValue: String) = apply { + dimensionValues = + (dimensionValues ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(dimensionValue) + } + } + + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) + + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): MatrixValue = + MatrixValue( + checkRequired("dimensionValues", dimensionValues).map { + it.toImmutable() + }, + checkRequired("unitAmount", unitAmount), + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is MatrixConfig && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(defaultUnitAmount, dimensions, matrixValues, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MatrixConfig{defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5925,35 +5375,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + @JvmField val MATRIX = of("matrix") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + MATRIX } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + MATRIX, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -5967,8 +5412,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + MATRIX -> Value.MATRIX else -> Value._UNKNOWN } @@ -5983,9 +5427,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + MATRIX -> Known.MATRIX + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -5995,7 +5438,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -6003,1034 +5446,495 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - @JvmStatic fun builder() = Builder() - } + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - private var additionalProperties: MutableMap = mutableMapOf() + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - 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(): BillingCycleConfiguration = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + duration() + durationUnit() + validated = true } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun toBuilder() = Builder().from(this) - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - 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 */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, matrixConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "NewFloatingMatrixPrice{cadence=$cadence, currency=$currency, itemId=$itemId, matrixConfig=$matrixConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" - } - - @NoAutoDetect - class NewFloatingMatrixWithAllocationPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("matrix_with_allocation_config") - @ExcludeMissing - private val matrixWithAllocationConfig: JsonField = - JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") - - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") - - fun matrixWithAllocationConfig(): MatrixWithAllocationConfig = - matrixWithAllocationConfig.getRequired("matrix_with_allocation_config") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - /** The name of the price. */ - fun name(): String = name.getRequired("name") - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("matrix_with_allocation_config") - @ExcludeMissing - fun _matrixWithAllocationConfig(): JsonField = - matrixWithAllocationConfig - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): NewFloatingMatrixWithAllocationPrice = apply { - if (validated) { - return@apply - } - - cadence() - currency() - itemId() - matrixWithAllocationConfig().validate() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [NewFloatingMatrixWithAllocationPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var matrixWithAllocationConfig: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } - - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - - /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun matrixWithAllocationConfig(matrixWithAllocationConfig: MatrixWithAllocationConfig) = - matrixWithAllocationConfig(JsonField.of(matrixWithAllocationConfig)) - - fun matrixWithAllocationConfig( - matrixWithAllocationConfig: JsonField - ) = apply { this.matrixWithAllocationConfig = matrixWithAllocationConfig } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** The unit of billing period duration. */ + class DurationUnit + @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`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + companion object { - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JvmField val DAY = of("day") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + @JvmField val MONTH = of("month") - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - fun build(): NewFloatingMatrixWithAllocationPrice = - NewFloatingMatrixWithAllocationPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("matrixWithAllocationConfig", matrixWithAllocationConfig), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the 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 asString(): String = _value().asStringOrThrow() - companion object { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val ANNUAL = of("annual") + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - @JvmField val SEMI_ANNUAL = of("semi_annual") + override fun hashCode() = value.hashCode() - @JvmField val MONTHLY = of("monthly") + override fun toString() = value.toString() + } - @JvmField val QUARTERLY = of("quarterly") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val ONE_TIME = of("one_time") + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } - @JvmField val CUSTOM = of("custom") + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + override fun hashCode(): Int = hashCode - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - fun asString(): String = _value().asStringOrThrow() + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun hashCode() = value.hashCode() + private var validated: Boolean = false - override fun toString() = value.toString() - } + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } - @NoAutoDetect - class MatrixWithAllocationConfig - @JsonCreator - private constructor( - @JsonProperty("allocation") - @ExcludeMissing - private val allocation: JsonField = JsonMissing.of(), - @JsonProperty("default_unit_amount") - @ExcludeMissing - private val defaultUnitAmount: JsonField = JsonMissing.of(), - @JsonProperty("dimensions") - @ExcludeMissing - private val dimensions: JsonField> = JsonMissing.of(), - @JsonProperty("matrix_values") - @ExcludeMissing - private val matrixValues: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + duration() + durationUnit() + validated = true + } - /** Allocation to be used to calculate the price */ - fun allocation(): Double = allocation.getRequired("allocation") + fun toBuilder() = Builder().from(this) - /** Default per unit rate for any usage not bucketed into a specified matrix_value */ - fun defaultUnitAmount(): String = defaultUnitAmount.getRequired("default_unit_amount") + companion object { - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(): List = dimensions.getRequired("dimensions") + @JvmStatic fun builder() = Builder() + } - /** Matrix values for specified matrix grouping keys */ - fun matrixValues(): List = matrixValues.getRequired("matrix_values") + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /** Allocation to be used to calculate the price */ - @JsonProperty("allocation") - @ExcludeMissing - fun _allocation(): JsonField = allocation + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** Default per unit rate for any usage not bucketed into a specified matrix_value */ - @JsonProperty("default_unit_amount") - @ExcludeMissing - fun _defaultUnitAmount(): JsonField = defaultUnitAmount + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") - @ExcludeMissing - fun _dimensions(): JsonField> = dimensions + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** Matrix values for specified matrix grouping keys */ - @JsonProperty("matrix_values") - @ExcludeMissing - fun _matrixValues(): JsonField> = matrixValues + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - private var validated: Boolean = false + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - fun validate(): MatrixWithAllocationConfig = apply { - if (validated) { - return@apply - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - allocation() - defaultUnitAmount() - dimensions() - matrixValues().forEach { it.validate() } - validated = true - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun toBuilder() = Builder().from(this) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - companion object { + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - @JvmStatic fun builder() = Builder() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** A builder for [MatrixWithAllocationConfig]. */ - class Builder internal constructor() { + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } - private var allocation: JsonField? = null - private var defaultUnitAmount: JsonField? = null - private var dimensions: JsonField>? = null - private var matrixValues: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - @JvmSynthetic - internal fun from(matrixWithAllocationConfig: MatrixWithAllocationConfig) = apply { - allocation = matrixWithAllocationConfig.allocation - defaultUnitAmount = matrixWithAllocationConfig.defaultUnitAmount - dimensions = matrixWithAllocationConfig.dimensions.map { it.toMutableList() } - matrixValues = - matrixWithAllocationConfig.matrixValues.map { it.toMutableList() } - additionalProperties = - matrixWithAllocationConfig.additionalProperties.toMutableMap() - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** Allocation to be used to calculate the price */ - fun allocation(allocation: Double) = allocation(JsonField.of(allocation)) + companion object { - /** Allocation to be used to calculate the price */ - fun allocation(allocation: JsonField) = apply { - this.allocation = allocation - } + @JvmField val DAY = of("day") - /** - * Default per unit rate for any usage not bucketed into a specified matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = - defaultUnitAmount(JsonField.of(defaultUnitAmount)) + @JvmField val MONTH = of("month") - /** - * Default per unit rate for any usage not bucketed into a specified matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: JsonField) = apply { - this.defaultUnitAmount = defaultUnitAmount - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(dimensions: JsonField>) = apply { - this.dimensions = dimensions.map { it.toMutableList() } - } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** One or two event property values to evaluate matrix groups by */ - fun addDimension(dimension: String) = apply { - dimensions = - (dimensions ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(dimension) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN } - } - /** Matrix values for specified matrix grouping keys */ - fun matrixValues(matrixValues: List) = - matrixValues(JsonField.of(matrixValues)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** Matrix values for specified matrix grouping keys */ - fun matrixValues(matrixValues: JsonField>) = apply { - this.matrixValues = matrixValues.map { it.toMutableList() } - } + fun asString(): String = _value().asStringOrThrow() - /** Matrix values for specified matrix grouping keys */ - fun addMatrixValue(matrixValue: MatrixValue) = apply { - matrixValues = - (matrixValues ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(matrixValue) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): MatrixWithAllocationConfig = - MatrixWithAllocationConfig( - checkRequired("allocation", allocation), - checkRequired("defaultUnitAmount", defaultUnitAmount), - checkRequired("dimensions", dimensions).map { it.toImmutable() }, - checkRequired("matrixValues", matrixValues).map { it.toImmutable() }, - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ @NoAutoDetect - class MatrixValue + class Metadata @JsonCreator private constructor( - @JsonProperty("dimension_values") - @ExcludeMissing - private val dimensionValues: JsonField> = JsonMissing.of(), - @JsonProperty("unit_amount") - @ExcludeMissing - private val unitAmount: JsonField = JsonMissing.of(), @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and an - * instance tier. - */ - fun dimensionValues(): List = - dimensionValues.getRequired("dimension_values") - - /** Unit price for the specified dimension_values */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and an - * instance tier. - */ - @JsonProperty("dimension_values") - @ExcludeMissing - fun _dimensionValues(): JsonField> = dimensionValues - - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") - @ExcludeMissing - fun _unitAmount(): JsonField = unitAmount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties private var validated: Boolean = false - fun validate(): MatrixValue = apply { + fun validate(): Metadata = apply { if (validated) { return@apply } - dimensionValues() - unitAmount() validated = true } @@ -7041,61 +5945,14 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [MatrixValue]. */ + /** A builder for [Metadata]. */ class Builder internal constructor() { - private var dimensionValues: JsonField>? = null - private var unitAmount: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(matrixValue: MatrixValue) = apply { - dimensionValues = matrixValue.dimensionValues.map { it.toMutableList() } - unitAmount = matrixValue.unitAmount - additionalProperties = matrixValue.additionalProperties.toMutableMap() - } - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and - * an instance tier. - */ - fun dimensionValues(dimensionValues: List) = - dimensionValues(JsonField.of(dimensionValues)) - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and - * an instance tier. - */ - fun dimensionValues(dimensionValues: JsonField>) = apply { - this.dimensionValues = dimensionValues.map { it.toMutableList() } - } - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and - * an instance tier. - */ - fun addDimensionValue(dimensionValue: String) = apply { - dimensionValues = - (dimensionValues ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(dimensionValue) - } - } - - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() } fun additionalProperties(additionalProperties: Map) = apply { @@ -7120,14 +5977,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): MatrixValue = - MatrixValue( - checkRequired("dimensionValues", dimensionValues).map { - it.toImmutable() - }, - checkRequired("unitAmount", unitAmount), - additionalProperties.toImmutable(), - ) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -7135,17 +5985,16 @@ private constructor( return true } - return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode - override fun toString() = - "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -7153,189 +6002,549 @@ private constructor( return true } - return /* spotless:off */ other is MatrixWithAllocationConfig && allocation == other.allocation && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingMatrixPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && matrixConfig == other.matrixConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(allocation, defaultUnitAmount, dimensions, matrixValues, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, matrixConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixWithAllocationConfig{allocation=$allocation, defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" + "NewFloatingMatrixPrice{cadence=$cadence, currency=$currency, itemId=$itemId, matrixConfig=$matrixConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - class ModelType + @NoAutoDetect + class NewFloatingMatrixWithAllocationPrice @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("matrix_with_allocation_config") + @ExcludeMissing + private val matrixWithAllocationConfig: JsonField = + JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") + + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") + + fun matrixWithAllocationConfig(): MatrixWithAllocationConfig = + matrixWithAllocationConfig.getRequired("matrix_with_allocation_config") + + fun modelType(): ModelType = modelType.getRequired("model_type") + + /** The name of the price. */ + fun name(): String = name.getRequired("name") /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - companion object { + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - @JvmField val MATRIX_WITH_ALLOCATION = of("matrix_with_allocation") + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_ALLOCATION, - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * 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. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - enum class Value { - MATRIX_WITH_ALLOCATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun value(): Value = - when (this) { - MATRIX_WITH_ALLOCATION -> Value.MATRIX_WITH_ALLOCATION - else -> Value._UNKNOWN - } + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun known(): Known = - when (this) { - MATRIX_WITH_ALLOCATION -> Known.MATRIX_WITH_ALLOCATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - fun asString(): String = _value().asStringOrThrow() + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - override fun hashCode() = value.hashCode() + @JsonProperty("matrix_with_allocation_config") + @ExcludeMissing + fun _matrixWithAllocationConfig(): JsonField = + matrixWithAllocationConfig - override fun toString() = value.toString() - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") + fun _billedInAdvance(): JsonField = billedInAdvance + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate + + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): NewFloatingMatrixWithAllocationPrice = apply { + if (validated) { + return@apply + } + + cadence() + currency() + itemId() + matrixWithAllocationConfig().validate() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NewFloatingMatrixWithAllocationPrice]. */ + class Builder internal constructor() { + + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var matrixWithAllocationConfig: JsonField? = + null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + 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() + } + + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + fun matrixWithAllocationConfig( + matrixWithAllocationConfig: MatrixWithAllocationConfig + ) = matrixWithAllocationConfig(JsonField.of(matrixWithAllocationConfig)) + + fun matrixWithAllocationConfig( + matrixWithAllocationConfig: JsonField + ) = apply { this.matrixWithAllocationConfig = matrixWithAllocationConfig } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } + + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - private var validated: Boolean = false + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } - duration() - durationUnit() - validated = true - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - fun toBuilder() = Builder().from(this) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - companion object { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @JvmStatic fun builder() = Builder() - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -7359,20 +6568,30 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), + fun build(): NewFloatingMatrixWithAllocationPrice = + NewFloatingMatrixWithAllocationPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("matrixWithAllocationConfig", matrixWithAllocationConfig), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -7386,35 +6605,50 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val MONTHLY = of("monthly") - @JvmField val MONTH = of("month") + @JvmField val QUARTERLY = of("quarterly") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmField val ONE_TIME = of("one_time") + + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [Cadence]'s known values. */ enum class Known { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * An instance of [Cadence] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -7428,8 +6662,12 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM else -> Value._UNKNOWN } @@ -7444,9 +6682,13 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") } fun asString(): String = _value().asStringOrThrow() @@ -7456,7 +6698,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -7464,146 +6706,400 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + @NoAutoDetect + class MatrixWithAllocationConfig + @JsonCreator + private constructor( + @JsonProperty("allocation") + @ExcludeMissing + private val allocation: JsonField = JsonMissing.of(), + @JsonProperty("default_unit_amount") + @ExcludeMissing + private val defaultUnitAmount: JsonField = JsonMissing.of(), + @JsonProperty("dimensions") + @ExcludeMissing + private val dimensions: JsonField> = JsonMissing.of(), + @JsonProperty("matrix_values") + @ExcludeMissing + private val matrixValues: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** Allocation to be used to calculate the price */ + fun allocation(): Double = allocation.getRequired("allocation") - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** + * Default per unit rate for any usage not bucketed into a specified matrix_value + */ + fun defaultUnitAmount(): String = + defaultUnitAmount.getRequired("default_unit_amount") - override fun hashCode(): Int = hashCode + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(): List = dimensions.getRequired("dimensions") - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** Matrix values for specified matrix grouping keys */ + fun matrixValues(): List = matrixValues.getRequired("matrix_values") - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** Allocation to be used to calculate the price */ + @JsonProperty("allocation") + @ExcludeMissing + fun _allocation(): JsonField = allocation - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** + * Default per unit rate for any usage not bucketed into a specified matrix_value + */ + @JsonProperty("default_unit_amount") + @ExcludeMissing + fun _defaultUnitAmount(): JsonField = defaultUnitAmount - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") + @ExcludeMissing + fun _dimensions(): JsonField> = dimensions - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** Matrix values for specified matrix grouping keys */ + @JsonProperty("matrix_values") + @ExcludeMissing + fun _matrixValues(): JsonField> = matrixValues - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): MatrixWithAllocationConfig = apply { + if (validated) { + return@apply + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + allocation() + defaultUnitAmount() + dimensions() + matrixValues().forEach { it.validate() } + validated = true } - duration() - durationUnit() - validated = true - } + fun toBuilder() = Builder().from(this) - fun toBuilder() = Builder().from(this) + companion object { - companion object { + @JvmStatic fun builder() = Builder() + } - @JvmStatic fun builder() = Builder() - } + /** A builder for [MatrixWithAllocationConfig]. */ + class Builder internal constructor() { - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + private var allocation: JsonField? = null + private var defaultUnitAmount: JsonField? = null + private var dimensions: JsonField>? = null + private var matrixValues: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmSynthetic + internal fun from(matrixWithAllocationConfig: MatrixWithAllocationConfig) = + apply { + allocation = matrixWithAllocationConfig.allocation + defaultUnitAmount = matrixWithAllocationConfig.defaultUnitAmount + dimensions = + matrixWithAllocationConfig.dimensions.map { it.toMutableList() } + matrixValues = + matrixWithAllocationConfig.matrixValues.map { it.toMutableList() } + additionalProperties = + matrixWithAllocationConfig.additionalProperties.toMutableMap() + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** Allocation to be used to calculate the price */ + fun allocation(allocation: Double) = allocation(JsonField.of(allocation)) + + /** Allocation to be used to calculate the price */ + fun allocation(allocation: JsonField) = apply { + this.allocation = allocation } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Default per unit rate for any usage not bucketed into a specified + * matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: String) = + defaultUnitAmount(JsonField.of(defaultUnitAmount)) - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Default per unit rate for any usage not bucketed into a specified + * matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: JsonField) = apply { + this.defaultUnitAmount = defaultUnitAmount + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(dimensions: JsonField>) = apply { + this.dimensions = dimensions.map { it.toMutableList() } + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + /** One or two event property values to evaluate matrix groups by */ + fun addDimension(dimension: String) = apply { + dimensions = + (dimensions ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(dimension) + } + } + + /** Matrix values for specified matrix grouping keys */ + fun matrixValues(matrixValues: List) = + matrixValues(JsonField.of(matrixValues)) + + /** Matrix values for specified matrix grouping keys */ + fun matrixValues(matrixValues: JsonField>) = apply { + this.matrixValues = matrixValues.map { it.toMutableList() } + } + + /** Matrix values for specified matrix grouping keys */ + fun addMatrixValue(matrixValue: MatrixValue) = apply { + matrixValues = + (matrixValues ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(matrixValue) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): MatrixWithAllocationConfig = + MatrixWithAllocationConfig( + checkRequired("allocation", allocation), + checkRequired("defaultUnitAmount", defaultUnitAmount), + checkRequired("dimensions", dimensions).map { it.toImmutable() }, + checkRequired("matrixValues", matrixValues).map { it.toImmutable() }, + additionalProperties.toImmutable(), + ) } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + @NoAutoDetect + class MatrixValue + @JsonCreator + private constructor( + @JsonProperty("dimension_values") + @ExcludeMissing + private val dimensionValues: JsonField> = JsonMissing.of(), + @JsonProperty("unit_amount") + @ExcludeMissing + private val unitAmount: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and + * an instance tier. + */ + fun dimensionValues(): List = + dimensionValues.getRequired("dimension_values") + + /** Unit price for the specified dimension_values */ + fun unitAmount(): String = unitAmount.getRequired("unit_amount") + + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and + * an instance tier. + */ + @JsonProperty("dimension_values") + @ExcludeMissing + fun _dimensionValues(): JsonField> = dimensionValues + + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") + @ExcludeMissing + fun _unitAmount(): JsonField = unitAmount + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): MatrixValue = apply { + if (validated) { + return@apply + } + + dimensionValues() + unitAmount() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [MatrixValue]. */ + class Builder internal constructor() { + + private var dimensionValues: JsonField>? = null + private var unitAmount: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(matrixValue: MatrixValue) = apply { + dimensionValues = matrixValue.dimensionValues.map { it.toMutableList() } + unitAmount = matrixValue.unitAmount + additionalProperties = matrixValue.additionalProperties.toMutableMap() + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun dimensionValues(dimensionValues: List) = + dimensionValues(JsonField.of(dimensionValues)) + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun dimensionValues(dimensionValues: JsonField>) = apply { + this.dimensionValues = dimensionValues.map { it.toMutableList() } + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun addDimensionValue(dimensionValue: String) = apply { + dimensionValues = + (dimensionValues ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(dimensionValue) + } + } + + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) + + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): MatrixValue = + MatrixValue( + checkRequired("dimensionValues", dimensionValues).map { + it.toImmutable() + }, + checkRequired("unitAmount", unitAmount), + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is MatrixValue && dimensionValues == other.dimensionValues && unitAmount == other.unitAmount && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(dimensionValues, unitAmount, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MatrixValue{dimensionValues=$dimensionValues, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is MatrixWithAllocationConfig && allocation == other.allocation && defaultUnitAmount == other.defaultUnitAmount && dimensions == other.dimensions && matrixValues == other.matrixValues && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(allocation, defaultUnitAmount, dimensions, matrixValues, additionalProperties) } + /* spotless:on */ - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "MatrixWithAllocationConfig{allocation=$allocation, defaultUnitAmount=$defaultUnitAmount, dimensions=$dimensions, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -7617,35 +7113,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val MATRIX_WITH_ALLOCATION = of("matrix_with_allocation") - @JvmField val MONTH = of("month") - - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + MATRIX_WITH_ALLOCATION } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + MATRIX_WITH_ALLOCATION, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -7659,8 +7150,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + MATRIX_WITH_ALLOCATION -> Value.MATRIX_WITH_ALLOCATION else -> Value._UNKNOWN } @@ -7675,9 +7165,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + MATRIX_WITH_ALLOCATION -> Known.MATRIX_WITH_ALLOCATION + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -7687,7 +7176,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -7695,1009 +7184,1358 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - private var validated: Boolean = false + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - fun validate(): Metadata = apply { - if (validated) { - return@apply + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - validated = true + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && 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 BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - fun toBuilder() = Builder().from(this) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - companion object { + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - @JvmStatic fun builder() = Builder() - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun asString(): String = _value().asStringOrThrow() - private var additionalProperties: MutableMap = mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - 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 */ - } + validated = true + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, matrixWithAllocationConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + fun toBuilder() = Builder().from(this) - override fun hashCode(): Int = hashCode + companion object { - 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}" - } + @JvmStatic fun builder() = Builder() + } - @NoAutoDetect - class NewFloatingTieredPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("tiered_config") - @ExcludeMissing - private val tieredConfig: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + private var additionalProperties: MutableMap = mutableMapOf() - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun tieredConfig(): TieredConfig = tieredConfig.getRequired("tiered_config") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("tiered_config") - @ExcludeMissing - fun _tieredConfig(): JsonField = tieredConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - private var validated: Boolean = false + override fun hashCode(): Int = hashCode - fun validate(): NewFloatingTieredPrice = apply { - if (validated) { - return@apply + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - cadence() - currency() - itemId() - modelType() - name() - tieredConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + 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 */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, matrixWithAllocationConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - @JvmStatic fun builder() = Builder() - } + override fun hashCode(): Int = hashCode - /** A builder for [NewFloatingTieredPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var tieredConfig: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + 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}" + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @NoAutoDetect + class NewFloatingTieredPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("tiered_config") + @ExcludeMissing + private val tieredConfig: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun currency(): String = currency.getRequired("currency") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun itemId(): String = itemId.getRequired("item_id") - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - fun tieredConfig(tieredConfig: TieredConfig) = tieredConfig(JsonField.of(tieredConfig)) - - fun tieredConfig(tieredConfig: JsonField) = apply { - this.tieredConfig = tieredConfig - } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + fun name(): String = name.getRequired("name") - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun tieredConfig(): TieredConfig = tieredConfig.getRequired("tiered_config") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + @JsonProperty("tiered_config") + @ExcludeMissing + fun _tieredConfig(): JsonField = tieredConfig /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private var validated: Boolean = false + + fun validate(): NewFloatingTieredPrice = apply { + if (validated) { + return@apply + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) + cadence() + currency() + itemId() + modelType() + name() + tieredConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + fun toBuilder() = Builder().from(this) + + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): NewFloatingTieredPrice = - NewFloatingTieredPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired("tieredConfig", tieredConfig), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [NewFloatingTieredPrice]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var tieredConfig: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @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() + } - companion object { + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - @JvmField val ANNUAL = of("annual") + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - @JvmField val SEMI_ANNUAL = of("semi_annual") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - @JvmField val MONTHLY = of("monthly") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @JvmField val QUARTERLY = of("quarterly") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - @JvmField val ONE_TIME = of("one_time") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - @JvmField val CUSTOM = of("custom") + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } + + fun tieredConfig(tieredConfig: TieredConfig) = + tieredConfig(JsonField.of(tieredConfig)) + + fun tieredConfig(tieredConfig: JsonField) = apply { + this.tieredConfig = tieredConfig + } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * The id of the billable metric for the price. Only needed if the price is + * usage-based. */ - _UNKNOWN, - } + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance } - fun asString(): String = _value().asStringOrThrow() + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - override fun hashCode() = value.hashCode() + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - override fun toString() = value.toString() - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - companion object { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @JvmField val TIERED = of("tiered") + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED, - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - /** - * 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. + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. */ - _UNKNOWN, - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + fun 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) { - TIERED -> Known.TIERED - else -> throw OrbInvalidDataException("Unknown ModelType: $value") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - fun asString(): String = _value().asStringOrThrow() + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + fun build(): NewFloatingTieredPrice = + NewFloatingTieredPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired("tieredConfig", tieredConfig), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - override fun hashCode() = value.hashCode() + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - override fun toString() = value.toString() - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - @NoAutoDetect - class TieredConfig - @JsonCreator - private constructor( - @JsonProperty("tiers") - @ExcludeMissing - private val tiers: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - /** Tiers for rating based on total usage quantities into the specified tier */ - fun tiers(): List = tiers.getRequired("tiers") + @JvmField val ANNUAL = of("annual") - /** Tiers for rating based on total usage quantities into the specified tier */ - @JsonProperty("tiers") @ExcludeMissing fun _tiers(): JsonField> = tiers + @JvmField val SEMI_ANNUAL = of("semi_annual") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val MONTHLY = of("monthly") - private var validated: Boolean = false + @JvmField val QUARTERLY = of("quarterly") - fun validate(): TieredConfig = apply { - if (validated) { - return@apply + @JvmField val ONE_TIME = of("one_time") + + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - tiers().forEach { it.validate() } - validated = true - } + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } - fun toBuilder() = Builder().from(this) + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - @JvmStatic fun builder() = Builder() + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - /** A builder for [TieredConfig]. */ - class Builder internal constructor() { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { - private var tiers: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - @JvmSynthetic - internal fun from(tieredConfig: TieredConfig) = apply { - tiers = tieredConfig.tiers.map { it.toMutableList() } - additionalProperties = tieredConfig.additionalProperties.toMutableMap() + companion object { + + @JvmField val TIERED = of("tiered") + + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** Tiers for rating based on total usage quantities into the specified tier */ - fun tiers(tiers: List) = tiers(JsonField.of(tiers)) + /** An enum containing [ModelType]'s known values. */ + enum class Known { + TIERED + } - /** Tiers for rating based on total usage quantities into the specified tier */ - fun tiers(tiers: JsonField>) = apply { - this.tiers = tiers.map { it.toMutableList() } + /** + * 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, } - /** Tiers for rating based on total usage quantities into the specified tier */ - fun addTier(tier: Tier) = apply { - tiers = - (tiers ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(tier) - } - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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 + } - 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) { + TIERED -> Known.TIERED + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun asString(): String = _value().asStringOrThrow() - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode() = value.hashCode() - fun build(): TieredConfig = - TieredConfig( - checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() - ) + override fun toString() = value.toString() } @NoAutoDetect - class Tier + class TieredConfig @JsonCreator private constructor( - @JsonProperty("first_unit") - @ExcludeMissing - private val firstUnit: JsonField = JsonMissing.of(), - @JsonProperty("unit_amount") + @JsonProperty("tiers") @ExcludeMissing - private val unitAmount: JsonField = JsonMissing.of(), - @JsonProperty("last_unit") - @ExcludeMissing - private val lastUnit: JsonField = JsonMissing.of(), + private val tiers: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Inclusive tier starting value */ - fun firstUnit(): Double = firstUnit.getRequired("first_unit") - - /** Amount per unit */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") - - /** Exclusive tier ending value. If null, this is treated as the last tier */ - fun lastUnit(): Optional = - Optional.ofNullable(lastUnit.getNullable("last_unit")) - - /** Inclusive tier starting value */ - @JsonProperty("first_unit") - @ExcludeMissing - fun _firstUnit(): JsonField = firstUnit - - /** Amount per unit */ - @JsonProperty("unit_amount") - @ExcludeMissing - fun _unitAmount(): JsonField = unitAmount + /** Tiers for rating based on total usage quantities into the specified tier */ + fun tiers(): List = tiers.getRequired("tiers") - /** Exclusive tier ending value. If null, this is treated as the last tier */ - @JsonProperty("last_unit") - @ExcludeMissing - fun _lastUnit(): JsonField = lastUnit + /** Tiers for rating based on total usage quantities into the specified tier */ + @JsonProperty("tiers") @ExcludeMissing fun _tiers(): JsonField> = tiers @JsonAnyGetter @ExcludeMissing @@ -8705,14 +8543,12 @@ private constructor( private var validated: Boolean = false - fun validate(): Tier = apply { + fun validate(): TieredConfig = apply { if (validated) { return@apply } - firstUnit() - unitAmount() - lastUnit() + tiers().forEach { it.validate() } validated = true } @@ -8723,52 +8559,40 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Tier]. */ + /** A builder for [TieredConfig]. */ class Builder internal constructor() { - private var firstUnit: JsonField? = null - private var unitAmount: JsonField? = null - private var lastUnit: JsonField = JsonMissing.of() + private var tiers: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tier: Tier) = apply { - firstUnit = tier.firstUnit - unitAmount = tier.unitAmount - lastUnit = tier.lastUnit - additionalProperties = tier.additionalProperties.toMutableMap() + internal fun from(tieredConfig: TieredConfig) = apply { + tiers = tieredConfig.tiers.map { it.toMutableList() } + additionalProperties = tieredConfig.additionalProperties.toMutableMap() } - /** Inclusive tier starting value */ - fun firstUnit(firstUnit: Double) = firstUnit(JsonField.of(firstUnit)) + /** Tiers for rating based on total usage quantities into the specified tier */ + fun tiers(tiers: List) = tiers(JsonField.of(tiers)) - /** Inclusive tier starting value */ - fun firstUnit(firstUnit: JsonField) = apply { - this.firstUnit = firstUnit + /** Tiers for rating based on total usage quantities into the specified tier */ + fun tiers(tiers: JsonField>) = apply { + this.tiers = tiers.map { it.toMutableList() } } - /** Amount per unit */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - - /** Amount per unit */ - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount + /** Tiers for rating based on total usage quantities into the specified tier */ + fun addTier(tier: Tier) = apply { + tiers = + (tiers ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(tier) + } } - /** Exclusive tier ending value. If null, this is treated as the last tier */ - fun lastUnit(lastUnit: Double?) = lastUnit(JsonField.ofNullable(lastUnit)) - - /** Exclusive tier ending value. If null, this is treated as the last tier */ - fun lastUnit(lastUnit: Double) = lastUnit(lastUnit as Double?) - - /** Exclusive tier ending value. If null, this is treated as the last tier */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun lastUnit(lastUnit: Optional) = - lastUnit(lastUnit.orElse(null) as Double?) - - /** Exclusive tier ending value. If null, this is treated as the last tier */ - fun lastUnit(lastUnit: JsonField) = apply { this.lastUnit = lastUnit } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -8791,576 +8615,754 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Tier = - Tier( - checkRequired("firstUnit", firstUnit), - checkRequired("unitAmount", unitAmount), - lastUnit, + fun build(): TieredConfig = + TieredConfig( + checkRequired("tiers", tiers).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } + @NoAutoDetect + class Tier + @JsonCreator + private constructor( + @JsonProperty("first_unit") + @ExcludeMissing + private val firstUnit: JsonField = JsonMissing.of(), + @JsonProperty("unit_amount") + @ExcludeMissing + private val unitAmount: JsonField = JsonMissing.of(), + @JsonProperty("last_unit") + @ExcludeMissing + private val lastUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** Inclusive tier starting value */ + fun firstUnit(): Double = firstUnit.getRequired("first_unit") + + /** Amount per unit */ + fun unitAmount(): String = unitAmount.getRequired("unit_amount") + + /** Exclusive tier ending value. If null, this is treated as the last tier */ + fun lastUnit(): Optional = + Optional.ofNullable(lastUnit.getNullable("last_unit")) + + /** Inclusive tier starting value */ + @JsonProperty("first_unit") + @ExcludeMissing + fun _firstUnit(): JsonField = firstUnit + + /** Amount per unit */ + @JsonProperty("unit_amount") + @ExcludeMissing + fun _unitAmount(): JsonField = unitAmount + + /** Exclusive tier ending value. If null, this is treated as the last tier */ + @JsonProperty("last_unit") + @ExcludeMissing + fun _lastUnit(): JsonField = lastUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Tier = apply { + if (validated) { + return@apply + } + + firstUnit() + unitAmount() + lastUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Tier]. */ + class Builder internal constructor() { + + private var firstUnit: JsonField? = null + private var unitAmount: JsonField? = null + private var lastUnit: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(tier: Tier) = apply { + firstUnit = tier.firstUnit + unitAmount = tier.unitAmount + lastUnit = tier.lastUnit + additionalProperties = tier.additionalProperties.toMutableMap() + } + + /** Inclusive tier starting value */ + fun firstUnit(firstUnit: Double) = firstUnit(JsonField.of(firstUnit)) + + /** Inclusive tier starting value */ + fun firstUnit(firstUnit: JsonField) = apply { + this.firstUnit = firstUnit + } + + /** Amount per unit */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) + + /** Amount per unit */ + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount + } + + /** + * Exclusive tier ending value. If null, this is treated as the last tier + */ + fun lastUnit(lastUnit: Double?) = lastUnit(JsonField.ofNullable(lastUnit)) + + /** + * Exclusive tier ending value. If null, this is treated as the last tier + */ + fun lastUnit(lastUnit: Double) = lastUnit(lastUnit as Double?) + + /** + * Exclusive tier ending value. If null, this is treated as the last tier + */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun lastUnit(lastUnit: Optional) = + lastUnit(lastUnit.orElse(null) as Double?) + + /** + * Exclusive tier ending value. If null, this is treated as the last tier + */ + fun lastUnit(lastUnit: JsonField) = apply { + this.lastUnit = lastUnit + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Tier = + Tier( + checkRequired("firstUnit", firstUnit), + checkRequired("unitAmount", unitAmount), + lastUnit, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && unitAmount == other.unitAmount && lastUnit == other.lastUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(firstUnit, unitAmount, lastUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Tier{firstUnit=$firstUnit, unitAmount=$unitAmount, lastUnit=$lastUnit, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Tier && firstUnit == other.firstUnit && unitAmount == other.unitAmount && lastUnit == other.lastUnit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredConfig && tiers == other.tiers && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(firstUnit, unitAmount, lastUnit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(tiers, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{firstUnit=$firstUnit, unitAmount=$unitAmount, lastUnit=$lastUnit, additionalProperties=$additionalProperties}" + "TieredConfig{tiers=$tiers, additionalProperties=$additionalProperties}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TieredConfig && tiers == other.tiers && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(tiers, additionalProperties) } - /* spotless:on */ + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - override fun hashCode(): Int = hashCode + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - override fun toString() = - "TieredConfig{tiers=$tiers, additionalProperties=$additionalProperties}" - } + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + private var validated: Boolean = false - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + duration() + durationUnit() + validated = true + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + @JvmStatic fun builder() = Builder() } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - @JvmStatic fun builder() = Builder() - } + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - @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: JsonField) = apply { this.duration = duration } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val DAY = of("day") - companion object { + @JvmField val MONTH = of("month") - @JvmField val DAY = of("day") + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmField val MONTH = of("month") + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. */ - _UNKNOWN, - } + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + fun asString(): String = _value().asStringOrThrow() - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + 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 DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - override fun hashCode(): Int = hashCode + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + private var validated: Boolean = false - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + duration() + durationUnit() + validated = true + } - private var validated: Boolean = false + fun toBuilder() = Builder().from(this) - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + companion object { + + @JvmStatic fun builder() = Builder() } - duration() - durationUnit() - validated = true - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - fun toBuilder() = Builder().from(this) + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - @JvmStatic fun builder() = Builder() - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val DAY = of("day") - companion object { + @JvmField val MONTH = of("month") - @JvmField val DAY = of("day") + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmField val MONTH = of("month") + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. */ - _UNKNOWN, - } + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + fun asString(): String = _value().asStringOrThrow() - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + 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 DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + validated = true + } - private var validated: Boolean = false + fun toBuilder() = Builder().from(this) - fun validate(): Metadata = apply { - if (validated) { - return@apply + companion object { + + @JvmStatic fun builder() = Builder() } - validated = true - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - fun toBuilder() = Builder().from(this) + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - @JvmStatic fun builder() = Builder() - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - private var additionalProperties: MutableMap = mutableMapOf() + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -9368,941 +9370,810 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredConfig == other.tieredConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - 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 */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "NewFloatingTieredPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredConfig=$tieredConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" - } - - @NoAutoDetect - class NewFloatingTieredBpsPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("tiered_bps_config") - @ExcludeMissing - private val tieredBpsConfig: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") - - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - /** The name of the price. */ - fun name(): String = name.getRequired("name") - - fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig.getRequired("tiered_bps_config") - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("tiered_bps_config") - @ExcludeMissing - fun _tieredBpsConfig(): JsonField = tieredBpsConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): NewFloatingTieredBpsPrice = apply { - if (validated) { - return@apply - } - - cadence() - currency() - itemId() - modelType() - name() - tieredBpsConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() + 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}" } - /** A builder for [NewFloatingTieredBpsPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var tieredBpsConfig: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } - - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @NoAutoDetect + class NewFloatingTieredBpsPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("tiered_bps_config") + @ExcludeMissing + private val tieredBpsConfig: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun currency(): String = currency.getRequired("currency") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun itemId(): String = itemId.getRequired("item_id") - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = - tieredBpsConfig(JsonField.of(tieredBpsConfig)) - - fun tieredBpsConfig(tieredBpsConfig: JsonField) = apply { - this.tieredBpsConfig = tieredBpsConfig - } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + fun name(): String = name.getRequired("name") - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun tieredBpsConfig(): TieredBpsConfig = + tieredBpsConfig.getRequired("tiered_bps_config") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + @JsonProperty("tiered_bps_config") + @ExcludeMissing + fun _tieredBpsConfig(): JsonField = tieredBpsConfig /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): NewFloatingTieredBpsPrice = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + cadence() + currency() + itemId() + modelType() + name() + tieredBpsConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): NewFloatingTieredBpsPrice = - NewFloatingTieredBpsPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired("tieredBpsConfig", tieredBpsConfig), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [NewFloatingTieredBpsPrice]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var tieredBpsConfig: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @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() + } - companion object { + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - @JvmField val ANNUAL = of("annual") + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - @JvmField val SEMI_ANNUAL = of("semi_annual") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - @JvmField val MONTHLY = of("monthly") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @JvmField val QUARTERLY = of("quarterly") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - @JvmField val ONE_TIME = of("one_time") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - @JvmField val CUSTOM = of("custom") + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } + + fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = + tieredBpsConfig(JsonField.of(tieredBpsConfig)) + + fun tieredBpsConfig(tieredBpsConfig: JsonField) = apply { + this.tieredBpsConfig = tieredBpsConfig + } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * The id of the billable metric for the price. Only needed if the price is + * usage-based. */ - _UNKNOWN, - } + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance } - fun asString(): String = _value().asStringOrThrow() + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - override fun hashCode() = value.hashCode() + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - override fun toString() = value.toString() - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - companion object { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @JvmField val TIERED_BPS = of("tiered_bps") + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_BPS, - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - /** - * 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. + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. */ - _UNKNOWN, - } + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + fun 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) { - TIERED_BPS -> Known.TIERED_BPS - else -> throw OrbInvalidDataException("Unknown ModelType: $value") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - fun asString(): String = _value().asStringOrThrow() + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + fun build(): NewFloatingTieredBpsPrice = + NewFloatingTieredBpsPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired("tieredBpsConfig", tieredBpsConfig), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - override fun hashCode() = value.hashCode() + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - override fun toString() = value.toString() - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - @NoAutoDetect - class TieredBpsConfig - @JsonCreator - private constructor( - @JsonProperty("tiers") - @ExcludeMissing - private val tiers: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - /** - * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified tiers - */ - fun tiers(): List = tiers.getRequired("tiers") + @JvmField val ANNUAL = of("annual") - /** - * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified tiers - */ - @JsonProperty("tiers") @ExcludeMissing fun _tiers(): JsonField> = tiers + @JvmField val SEMI_ANNUAL = of("semi_annual") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val MONTHLY = of("monthly") - private var validated: Boolean = false + @JvmField val QUARTERLY = of("quarterly") - fun validate(): TieredBpsConfig = apply { - if (validated) { - return@apply + @JvmField val ONE_TIME = of("one_time") + + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - tiers().forEach { it.validate() } - validated = true + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } + + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun toBuilder() = Builder().from(this) + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { - companion object { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - @JvmStatic fun builder() = Builder() - } + companion object { - /** A builder for [TieredBpsConfig]. */ - class Builder internal constructor() { + @JvmField val TIERED_BPS = of("tiered_bps") - private var tiers: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(tieredBpsConfig: TieredBpsConfig) = apply { - tiers = tieredBpsConfig.tiers.map { it.toMutableList() } - additionalProperties = tieredBpsConfig.additionalProperties.toMutableMap() + /** An enum containing [ModelType]'s known values. */ + enum class Known { + TIERED_BPS } /** - * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified - * tiers + * 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. */ - fun tiers(tiers: List) = tiers(JsonField.of(tiers)) + enum class Value { + TIERED_BPS, + /** + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } /** - * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified - * tiers + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - fun tiers(tiers: JsonField>) = apply { - this.tiers = tiers.map { it.toMutableList() } - } + fun value(): Value = + when (this) { + TIERED_BPS -> Value.TIERED_BPS + else -> Value._UNKNOWN + } /** - * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified - * tiers + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. */ - fun addTier(tier: Tier) = apply { - tiers = - (tiers ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(tier) - } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun known(): Known = + when (this) { + TIERED_BPS -> Known.TIERED_BPS + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun asString(): String = _value().asStringOrThrow() - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode() = value.hashCode() - fun build(): TieredBpsConfig = - TieredBpsConfig( - checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() - ) + override fun toString() = value.toString() } @NoAutoDetect - class Tier + class TieredBpsConfig @JsonCreator private constructor( - @JsonProperty("bps") + @JsonProperty("tiers") @ExcludeMissing - private val bps: JsonField = JsonMissing.of(), - @JsonProperty("minimum_amount") - @ExcludeMissing - private val minimumAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("per_unit_maximum") - @ExcludeMissing - private val perUnitMaximum: JsonField = JsonMissing.of(), + private val tiers: JsonField> = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - /** Per-event basis point rate */ - fun bps(): Double = bps.getRequired("bps") - - /** Inclusive tier starting value */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - - /** Exclusive tier ending value */ - fun maximumAmount(): Optional = - Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - - /** Per unit maximum to charge */ - fun perUnitMaximum(): Optional = - Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) - - /** Per-event basis point rate */ - @JsonProperty("bps") @ExcludeMissing fun _bps(): JsonField = bps - - /** Inclusive tier starting value */ - @JsonProperty("minimum_amount") - @ExcludeMissing - fun _minimumAmount(): JsonField = minimumAmount - - /** Exclusive tier ending value */ - @JsonProperty("maximum_amount") - @ExcludeMissing - fun _maximumAmount(): JsonField = maximumAmount + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified + * tiers + */ + fun tiers(): List = tiers.getRequired("tiers") - /** Per unit maximum to charge */ - @JsonProperty("per_unit_maximum") - @ExcludeMissing - fun _perUnitMaximum(): JsonField = perUnitMaximum + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified + * tiers + */ + @JsonProperty("tiers") @ExcludeMissing fun _tiers(): JsonField> = tiers @JsonAnyGetter @ExcludeMissing @@ -10310,15 +10181,12 @@ private constructor( private var validated: Boolean = false - fun validate(): Tier = apply { + fun validate(): TieredBpsConfig = apply { if (validated) { return@apply } - bps() - minimumAmount() - maximumAmount() - perUnitMaximum() + tiers().forEach { it.validate() } validated = true } @@ -10329,63 +10197,47 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Tier]. */ + /** A builder for [TieredBpsConfig]. */ class Builder internal constructor() { - private var bps: JsonField? = null - private var minimumAmount: JsonField? = null - private var maximumAmount: JsonField = JsonMissing.of() - private var perUnitMaximum: JsonField = JsonMissing.of() + private var tiers: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tier: Tier) = apply { - bps = tier.bps - minimumAmount = tier.minimumAmount - maximumAmount = tier.maximumAmount - perUnitMaximum = tier.perUnitMaximum - additionalProperties = tier.additionalProperties.toMutableMap() - } - - /** Per-event basis point rate */ - fun bps(bps: Double) = bps(JsonField.of(bps)) - - /** Per-event basis point rate */ - fun bps(bps: JsonField) = apply { this.bps = bps } - - /** Inclusive tier starting value */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Inclusive tier starting value */ - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount + internal fun from(tieredBpsConfig: TieredBpsConfig) = apply { + tiers = tieredBpsConfig.tiers.map { it.toMutableList() } + additionalProperties = tieredBpsConfig.additionalProperties.toMutableMap() } - /** Exclusive tier ending value */ - fun maximumAmount(maximumAmount: String?) = - maximumAmount(JsonField.ofNullable(maximumAmount)) - - /** Exclusive tier ending value */ - fun maximumAmount(maximumAmount: Optional) = - maximumAmount(maximumAmount.orElse(null)) + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into + * specified tiers + */ + fun tiers(tiers: List) = tiers(JsonField.of(tiers)) - /** Exclusive tier ending value */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into + * specified tiers + */ + fun tiers(tiers: JsonField>) = apply { + this.tiers = tiers.map { it.toMutableList() } } - /** Per unit maximum to charge */ - fun perUnitMaximum(perUnitMaximum: String?) = - perUnitMaximum(JsonField.ofNullable(perUnitMaximum)) - - /** Per unit maximum to charge */ - fun perUnitMaximum(perUnitMaximum: Optional) = - perUnitMaximum(perUnitMaximum.orElse(null)) - - /** Per unit maximum to charge */ - fun perUnitMaximum(perUnitMaximum: JsonField) = apply { - this.perUnitMaximum = perUnitMaximum + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into + * specified tiers + */ + fun addTier(tier: Tier) = apply { + tiers = + (tiers ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(tier) + } } fun additionalProperties(additionalProperties: Map) = apply { @@ -10410,577 +10262,767 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Tier = - Tier( - checkRequired("bps", bps), - checkRequired("minimumAmount", minimumAmount), - maximumAmount, - perUnitMaximum, + fun build(): TieredBpsConfig = + TieredBpsConfig( + checkRequired("tiers", tiers).map { it.toImmutable() }, additionalProperties.toImmutable(), ) } + @NoAutoDetect + class Tier + @JsonCreator + private constructor( + @JsonProperty("bps") + @ExcludeMissing + private val bps: JsonField = JsonMissing.of(), + @JsonProperty("minimum_amount") + @ExcludeMissing + private val minimumAmount: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("per_unit_maximum") + @ExcludeMissing + private val perUnitMaximum: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** Per-event basis point rate */ + fun bps(): Double = bps.getRequired("bps") + + /** Inclusive tier starting value */ + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") + + /** Exclusive tier ending value */ + fun maximumAmount(): Optional = + Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) + + /** Per unit maximum to charge */ + fun perUnitMaximum(): Optional = + Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) + + /** Per-event basis point rate */ + @JsonProperty("bps") @ExcludeMissing fun _bps(): JsonField = bps + + /** Inclusive tier starting value */ + @JsonProperty("minimum_amount") + @ExcludeMissing + fun _minimumAmount(): JsonField = minimumAmount + + /** Exclusive tier ending value */ + @JsonProperty("maximum_amount") + @ExcludeMissing + fun _maximumAmount(): JsonField = maximumAmount + + /** Per unit maximum to charge */ + @JsonProperty("per_unit_maximum") + @ExcludeMissing + fun _perUnitMaximum(): JsonField = perUnitMaximum + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Tier = apply { + if (validated) { + return@apply + } + + bps() + minimumAmount() + maximumAmount() + perUnitMaximum() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Tier]. */ + class Builder internal constructor() { + + private var bps: JsonField? = null + private var minimumAmount: JsonField? = null + private var maximumAmount: JsonField = JsonMissing.of() + private var perUnitMaximum: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(tier: Tier) = apply { + bps = tier.bps + minimumAmount = tier.minimumAmount + maximumAmount = tier.maximumAmount + perUnitMaximum = tier.perUnitMaximum + additionalProperties = tier.additionalProperties.toMutableMap() + } + + /** Per-event basis point rate */ + fun bps(bps: Double) = bps(JsonField.of(bps)) + + /** Per-event basis point rate */ + fun bps(bps: JsonField) = apply { this.bps = bps } + + /** Inclusive tier starting value */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Inclusive tier starting value */ + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + + /** Exclusive tier ending value */ + fun maximumAmount(maximumAmount: String?) = + maximumAmount(JsonField.ofNullable(maximumAmount)) + + /** Exclusive tier ending value */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) + + /** Exclusive tier ending value */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + + /** Per unit maximum to charge */ + fun perUnitMaximum(perUnitMaximum: String?) = + perUnitMaximum(JsonField.ofNullable(perUnitMaximum)) + + /** Per unit maximum to charge */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + + /** Per unit maximum to charge */ + fun perUnitMaximum(perUnitMaximum: JsonField) = apply { + this.perUnitMaximum = perUnitMaximum + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Tier = + Tier( + checkRequired("bps", bps), + checkRequired("minimumAmount", minimumAmount), + maximumAmount, + perUnitMaximum, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Tier && bps == other.bps && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(bps, minimumAmount, maximumAmount, perUnitMaximum, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Tier{bps=$bps, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Tier && bps == other.bps && minimumAmount == other.minimumAmount && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredBpsConfig && tiers == other.tiers && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(bps, minimumAmount, maximumAmount, perUnitMaximum, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(tiers, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tier{bps=$bps, minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "TieredBpsConfig{tiers=$tiers, additionalProperties=$additionalProperties}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TieredBpsConfig && tiers == other.tiers && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(tiers, additionalProperties) } - /* spotless:on */ + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - override fun hashCode(): Int = hashCode + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - override fun toString() = - "TieredBpsConfig{tiers=$tiers, additionalProperties=$additionalProperties}" - } + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + private var validated: Boolean = false - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + duration() + durationUnit() + validated = true + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + @JvmStatic fun builder() = Builder() } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - @JvmStatic fun builder() = Builder() - } + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - @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: JsonField) = apply { this.duration = duration } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val DAY = of("day") - companion object { + @JvmField val MONTH = of("month") - @JvmField val DAY = of("day") + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmField val MONTH = of("month") + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. */ - _UNKNOWN, - } + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + fun asString(): String = _value().asStringOrThrow() - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + 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 DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - override fun hashCode(): Int = hashCode + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + private var validated: Boolean = false - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + duration() + durationUnit() + validated = true + } - private var validated: Boolean = false + fun toBuilder() = Builder().from(this) - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + companion object { + + @JvmStatic fun builder() = Builder() } - duration() - durationUnit() - validated = true - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - fun toBuilder() = Builder().from(this) + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - @JvmStatic fun builder() = Builder() - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val DAY = of("day") - companion object { + @JvmField val MONTH = of("month") - @JvmField val DAY = of("day") + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmField val MONTH = of("month") + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. */ - _UNKNOWN, - } + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + fun asString(): String = _value().asStringOrThrow() - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + 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 DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + validated = true + } - private var validated: Boolean = false + fun toBuilder() = Builder().from(this) - fun validate(): Metadata = apply { - if (validated) { - return@apply + companion object { + + @JvmStatic fun builder() = Builder() } - validated = true - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - fun toBuilder() = Builder().from(this) + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - @JvmStatic fun builder() = Builder() - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - private var additionalProperties: MutableMap = mutableMapOf() + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -10988,592 +11030,228 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredBpsPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredBpsConfig == other.tieredBpsConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredBpsConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - 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 */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredBpsConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "NewFloatingTieredBpsPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredBpsConfig=$tieredBpsConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" - } - - @NoAutoDetect - class NewFloatingBpsPrice - @JsonCreator - private constructor( - @JsonProperty("bps_config") - @ExcludeMissing - private val bpsConfig: JsonField = JsonMissing.of(), - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - fun bpsConfig(): BpsConfig = bpsConfig.getRequired("bps_config") - - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") - - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - /** The name of the price. */ - fun name(): String = name.getRequired("name") - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - @JsonProperty("bps_config") - @ExcludeMissing - fun _bpsConfig(): JsonField = bpsConfig - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): NewFloatingBpsPrice = apply { - if (validated) { - return@apply - } - - bpsConfig().validate() - cadence() - currency() - itemId() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() + 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}" } - /** A builder for [NewFloatingBpsPrice]. */ - class Builder internal constructor() { - - private var bpsConfig: JsonField? = null - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } - - fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) - - fun bpsConfig(bpsConfig: JsonField) = apply { this.bpsConfig = bpsConfig } + @NoAutoDetect + class NewFloatingBpsPrice + @JsonCreator + private constructor( + @JsonProperty("bps_config") + @ExcludeMissing + private val bpsConfig: JsonField = JsonMissing.of(), + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun bpsConfig(): BpsConfig = bpsConfig.getRequired("bps_config") /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun currency(): String = currency.getRequired("currency") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun itemId(): String = itemId.getRequired("item_id") - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + fun modelType(): ModelType = modelType.getRequired("model_type") - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + /** The name of the price. */ + fun name(): String = name.getRequired("name") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + @JsonProperty("bps_config") + @ExcludeMissing + fun _bpsConfig(): JsonField = bpsConfig - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): NewFloatingBpsPrice = - NewFloatingBpsPrice( - checkRequired("bpsConfig", bpsConfig), - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } - - @NoAutoDetect - class BpsConfig - @JsonCreator - private constructor( - @JsonProperty("bps") - @ExcludeMissing - private val bps: JsonField = JsonMissing.of(), - @JsonProperty("per_unit_maximum") - @ExcludeMissing - private val perUnitMaximum: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** Basis point take rate per event */ - fun bps(): Double = bps.getRequired("bps") - - /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(): Optional = - Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) - - /** Basis point take rate per event */ - @JsonProperty("bps") @ExcludeMissing fun _bps(): JsonField = bps - - /** Optional currency amount maximum to cap spend per event */ - @JsonProperty("per_unit_maximum") + @JsonProperty("metadata") @ExcludeMissing - fun _perUnitMaximum(): JsonField = perUnitMaximum + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -11581,13 +11259,26 @@ private constructor( private var validated: Boolean = false - fun validate(): BpsConfig = apply { + fun validate(): NewFloatingBpsPrice = apply { if (validated) { return@apply } - bps() - perUnitMaximum() + bpsConfig().validate() + cadence() + currency() + itemId() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } validated = true } @@ -11598,376 +11289,278 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [BpsConfig]. */ + /** A builder for [NewFloatingBpsPrice]. */ class Builder internal constructor() { - private var bps: JsonField? = null - private var perUnitMaximum: JsonField = JsonMissing.of() + private var bpsConfig: JsonField? = null + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bpsConfig: BpsConfig) = apply { - bps = bpsConfig.bps - perUnitMaximum = bpsConfig.perUnitMaximum - additionalProperties = bpsConfig.additionalProperties.toMutableMap() - } - - /** Basis point take rate per event */ - fun bps(bps: Double) = bps(JsonField.of(bps)) - - /** Basis point take rate per event */ - fun bps(bps: JsonField) = apply { this.bps = bps } - - /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(perUnitMaximum: String?) = - perUnitMaximum(JsonField.ofNullable(perUnitMaximum)) - - /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(perUnitMaximum: Optional) = - perUnitMaximum(perUnitMaximum.orElse(null)) - - /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(perUnitMaximum: JsonField) = apply { - this.perUnitMaximum = perUnitMaximum + 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() } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): BpsConfig = - BpsConfig( - checkRequired("bps", bps), - perUnitMaximum, - additionalProperties.toImmutable(), - ) - } + fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun bpsConfig(bpsConfig: JsonField) = apply { + this.bpsConfig = bpsConfig } - return /* spotless:off */ other is BpsConfig && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(bps, perUnitMaximum, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BpsConfig{bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" - } - - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - companion object { + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - @JvmField val ANNUAL = of("annual") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - @JvmField val SEMI_ANNUAL = of("semi_annual") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @JvmField val MONTHLY = of("monthly") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - @JvmField val QUARTERLY = of("quarterly") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - @JvmField val ONE_TIME = of("one_time") + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - @JvmField val CUSTOM = of("custom") + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * The id of the billable metric for the price. Only needed if the price is + * usage-based. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - fun asString(): String = _value().asStringOrThrow() + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - 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. + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 - } + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - fun asString(): String = _value().asStringOrThrow() + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - override fun toString() = value.toString() - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - private var validated: Boolean = false + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } - duration() - durationUnit() - validated = true - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - fun toBuilder() = Builder().from(this) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - companion object { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @JvmStatic fun builder() = Builder() - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -11991,20 +11584,163 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), + fun build(): NewFloatingBpsPrice = + NewFloatingBpsPrice( + checkRequired("bpsConfig", bpsConfig), + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } - /** The unit of billing period duration. */ - class DurationUnit + @NoAutoDetect + class BpsConfig @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("bps") + @ExcludeMissing + private val bps: JsonField = JsonMissing.of(), + @JsonProperty("per_unit_maximum") + @ExcludeMissing + private val perUnitMaximum: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** Basis point take rate per event */ + fun bps(): Double = bps.getRequired("bps") + + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(): Optional = + Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) + + /** Basis point take rate per event */ + @JsonProperty("bps") @ExcludeMissing fun _bps(): JsonField = bps + + /** Optional currency amount maximum to cap spend per event */ + @JsonProperty("per_unit_maximum") + @ExcludeMissing + fun _perUnitMaximum(): JsonField = perUnitMaximum + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BpsConfig = apply { + if (validated) { + return@apply + } + + bps() + perUnitMaximum() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BpsConfig]. */ + class Builder internal constructor() { + + private var bps: JsonField? = null + private var perUnitMaximum: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(bpsConfig: BpsConfig) = apply { + bps = bpsConfig.bps + perUnitMaximum = bpsConfig.perUnitMaximum + additionalProperties = bpsConfig.additionalProperties.toMutableMap() + } + + /** Basis point take rate per event */ + fun bps(bps: Double) = bps(JsonField.of(bps)) + + /** Basis point take rate per event */ + fun bps(bps: JsonField) = apply { this.bps = bps } + + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(perUnitMaximum: String?) = + perUnitMaximum(JsonField.ofNullable(perUnitMaximum)) + + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) + + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(perUnitMaximum: JsonField) = apply { + this.perUnitMaximum = perUnitMaximum + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BpsConfig = + BpsConfig( + checkRequired("bps", bps), + perUnitMaximum, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BpsConfig && bps == other.bps && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(bps, perUnitMaximum, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BpsConfig{bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + } + + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -12018,35 +11754,50 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val MONTHLY = of("monthly") - @JvmField val MONTH = of("month") + @JvmField val QUARTERLY = of("quarterly") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmField val ONE_TIME = of("one_time") + + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [Cadence]'s known values. */ enum class Known { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * An instance of [Cadence] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -12060,8 +11811,12 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM else -> Value._UNKNOWN } @@ -12076,166 +11831,32 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DurationUnit && 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 BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") - - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration - - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply - } - - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { - - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } - - 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 asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode() = value.hashCode() - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun toString() = value.toString() } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -12249,35 +11870,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + @JvmField val BPS = of("bps") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + BPS } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + BPS, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -12291,8 +11907,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + BPS -> Value.BPS else -> Value._UNKNOWN } @@ -12307,9 +11922,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + BPS -> Known.BPS + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -12319,7 +11933,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -12327,681 +11941,784 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - private var validated: Boolean = false + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - fun validate(): Metadata = apply { - if (validated) { - return@apply + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - validated = true + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && 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 BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - fun toBuilder() = Builder().from(this) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - companion object { + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - @JvmStatic fun builder() = Builder() - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun asString(): String = _value().asStringOrThrow() - private var additionalProperties: MutableMap = mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - 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 */ - } + validated = true + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + fun toBuilder() = Builder().from(this) - override fun hashCode(): Int = hashCode + companion object { - 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}" - } + @JvmStatic fun builder() = Builder() + } - @NoAutoDetect - class NewFloatingBulkBpsPrice - @JsonCreator - private constructor( - @JsonProperty("bulk_bps_config") - @ExcludeMissing - private val bulkBpsConfig: JsonField = JsonMissing.of(), - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** A builder for [Metadata]. */ + class Builder internal constructor() { - fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig.getRequired("bulk_bps_config") + private var additionalProperties: MutableMap = mutableMapOf() - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - @JsonProperty("bulk_bps_config") - @ExcludeMissing - fun _bulkBpsConfig(): JsonField = bulkBpsConfig - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - private var validated: Boolean = false + override fun hashCode(): Int = hashCode - fun validate(): NewFloatingBulkBpsPrice = apply { - if (validated) { - return@apply + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - bulkBpsConfig().validate() - cadence() - currency() - itemId() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + 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 */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - @JvmStatic fun builder() = Builder() + 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}" } - /** A builder for [NewFloatingBulkBpsPrice]. */ - class Builder internal constructor() { - - private var bulkBpsConfig: JsonField? = null - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } - - fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = - bulkBpsConfig(JsonField.of(bulkBpsConfig)) - - fun bulkBpsConfig(bulkBpsConfig: JsonField) = apply { - this.bulkBpsConfig = bulkBpsConfig - } + @NoAutoDetect + class NewFloatingBulkBpsPrice + @JsonCreator + private constructor( + @JsonProperty("bulk_bps_config") + @ExcludeMissing + private val bulkBpsConfig: JsonField = JsonMissing.of(), + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig.getRequired("bulk_bps_config") /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun currency(): String = currency.getRequired("currency") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + fun itemId(): String = itemId.getRequired("item_id") - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun name(): String = name.getRequired("name") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } - - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) - - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonProperty("bulk_bps_config") + @ExcludeMissing + fun _bulkBpsConfig(): JsonField = bulkBpsConfig + + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId + + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType + + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId - fun build(): NewFloatingBulkBpsPrice = - NewFloatingBulkBpsPrice( - checkRequired("bulkBpsConfig", bulkBpsConfig), - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - @NoAutoDetect - class BulkBpsConfig - @JsonCreator - private constructor( - @JsonProperty("tiers") + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") @ExcludeMissing - private val tiers: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** - * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier - * based on total volume + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun tiers(): List = tiers.getRequired("tiers") + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** - * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier - * based on total volume + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - @JsonProperty("tiers") @ExcludeMissing fun _tiers(): JsonField> = tiers + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -13009,12 +12726,26 @@ private constructor( private var validated: Boolean = false - fun validate(): BulkBpsConfig = apply { + fun validate(): NewFloatingBulkBpsPrice = apply { if (validated) { return@apply } - tiers().forEach { it.validate() } + bulkBpsConfig().validate() + cadence() + currency() + itemId() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } validated = true } @@ -13025,584 +12756,626 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [BulkBpsConfig]. */ + /** A builder for [NewFloatingBulkBpsPrice]. */ class Builder internal constructor() { - private var tiers: JsonField>? = null + private var bulkBpsConfig: JsonField? = null + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bulkBpsConfig: BulkBpsConfig) = apply { - tiers = bulkBpsConfig.tiers.map { it.toMutableList() } - additionalProperties = bulkBpsConfig.additionalProperties.toMutableMap() + 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() } - /** - * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier - * based on total volume - */ - fun tiers(tiers: List) = tiers(JsonField.of(tiers)) + fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = + bulkBpsConfig(JsonField.of(bulkBpsConfig)) - /** - * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier - * based on total volume - */ - fun tiers(tiers: JsonField>) = apply { - this.tiers = tiers.map { it.toMutableList() } + fun bulkBpsConfig(bulkBpsConfig: JsonField) = apply { + this.bulkBpsConfig = bulkBpsConfig } - /** - * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier - * based on total volume - */ - fun addTier(tier: Tier) = apply { - tiers = - (tiers ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(tier) - } - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType } - fun build(): BulkBpsConfig = - BulkBpsConfig( - checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() - ) - } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - @NoAutoDetect - class Tier - @JsonCreator - private constructor( - @JsonProperty("bps") - @ExcludeMissing - private val bps: JsonField = JsonMissing.of(), - @JsonProperty("maximum_amount") - @ExcludeMissing - private val maximumAmount: JsonField = JsonMissing.of(), - @JsonProperty("per_unit_maximum") - @ExcludeMissing - private val perUnitMaximum: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** Basis points to rate on */ - fun bps(): Double = bps.getRequired("bps") + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - /** Upper bound for tier */ - fun maximumAmount(): Optional = - Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - /** The maximum amount to charge for any one event */ - fun perUnitMaximum(): Optional = - Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } - /** Basis points to rate on */ - @JsonProperty("bps") @ExcludeMissing fun _bps(): JsonField = bps + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - /** Upper bound for tier */ - @JsonProperty("maximum_amount") - @ExcludeMissing - fun _maximumAmount(): JsonField = maximumAmount + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** The maximum amount to charge for any one event */ - @JsonProperty("per_unit_maximum") - @ExcludeMissing - fun _perUnitMaximum(): JsonField = perUnitMaximum + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - private var validated: Boolean = false + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - fun validate(): Tier = apply { - if (validated) { - return@apply - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - bps() - maximumAmount() - perUnitMaximum() - validated = true - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - fun toBuilder() = Builder().from(this) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - companion object { + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - @JvmStatic fun builder() = Builder() + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate } - /** A builder for [Tier]. */ - class Builder internal constructor() { + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - private var bps: JsonField? = null - private var maximumAmount: JsonField = JsonMissing.of() - private var perUnitMaximum: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - @JvmSynthetic - internal fun from(tier: Tier) = apply { - bps = tier.bps - maximumAmount = tier.maximumAmount - perUnitMaximum = tier.perUnitMaximum - additionalProperties = tier.additionalProperties.toMutableMap() - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - /** Basis points to rate on */ - fun bps(bps: Double) = bps(JsonField.of(bps)) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - /** Basis points to rate on */ - fun bps(bps: JsonField) = apply { this.bps = bps } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - /** Upper bound for tier */ - fun maximumAmount(maximumAmount: String?) = - maximumAmount(JsonField.ofNullable(maximumAmount)) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - /** Upper bound for tier */ - fun maximumAmount(maximumAmount: Optional) = - maximumAmount(maximumAmount.orElse(null)) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** Upper bound for tier */ - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - /** The maximum amount to charge for any one event */ - fun perUnitMaximum(perUnitMaximum: String?) = - perUnitMaximum(JsonField.ofNullable(perUnitMaximum)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - /** The maximum amount to charge for any one event */ - fun perUnitMaximum(perUnitMaximum: Optional) = - perUnitMaximum(perUnitMaximum.orElse(null)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - /** The maximum amount to charge for any one event */ - fun perUnitMaximum(perUnitMaximum: JsonField) = apply { - this.perUnitMaximum = perUnitMaximum - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - fun build(): Tier = - Tier( - checkRequired("bps", bps), - maximumAmount, - perUnitMaximum, - additionalProperties.toImmutable(), - ) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Tier && bps == other.bps && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(bps, maximumAmount, perUnitMaximum, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun toString() = - "Tier{bps=$bps, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - return /* spotless:off */ other is BulkBpsConfig && tiers == other.tiers && additionalProperties == other.additionalProperties /* spotless:on */ + fun build(): NewFloatingBulkBpsPrice = + NewFloatingBulkBpsPrice( + checkRequired("bulkBpsConfig", bulkBpsConfig), + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(tiers, additionalProperties) } - /* spotless:on */ + @NoAutoDetect + class BulkBpsConfig + @JsonCreator + private constructor( + @JsonProperty("tiers") + @ExcludeMissing + private val tiers: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - override fun hashCode(): Int = hashCode + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier + * based on total volume + */ + fun tiers(): List = tiers.getRequired("tiers") - override fun toString() = - "BulkBpsConfig{tiers=$tiers, additionalProperties=$additionalProperties}" - } + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier + * based on total volume + */ + @JsonProperty("tiers") @ExcludeMissing fun _tiers(): JsonField> = tiers - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + @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 + private var validated: Boolean = false + + fun validate(): BulkBpsConfig = apply { + if (validated) { + return@apply + } - companion object { + tiers().forEach { it.validate() } + validated = true + } - @JvmField val ANNUAL = of("annual") + fun toBuilder() = Builder().from(this) - @JvmField val SEMI_ANNUAL = of("semi_annual") + companion object { - @JvmField val MONTHLY = of("monthly") + @JvmStatic fun builder() = Builder() + } - @JvmField val QUARTERLY = of("quarterly") + /** A builder for [BulkBpsConfig]. */ + class Builder internal constructor() { - @JvmField val ONE_TIME = of("one_time") + private var tiers: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() - @JvmField val CUSTOM = of("custom") + @JvmSynthetic + internal fun from(bulkBpsConfig: BulkBpsConfig) = apply { + tiers = bulkBpsConfig.tiers.map { it.toMutableList() } + additionalProperties = bulkBpsConfig.additionalProperties.toMutableMap() + } - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a single + * tier based on total volume + */ + fun tiers(tiers: List) = tiers(JsonField.of(tiers)) - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a single + * tier based on total volume + */ + fun tiers(tiers: JsonField>) = apply { + this.tiers = tiers.map { it.toMutableList() } + } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a single + * tier based on total volume + */ + fun addTier(tier: Tier) = apply { + tiers = + (tiers ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(tier) + } + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + 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) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun asString(): String = _value().asStringOrThrow() + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - override fun hashCode() = value.hashCode() + fun build(): BulkBpsConfig = + BulkBpsConfig( + checkRequired("tiers", tiers).map { it.toImmutable() }, + additionalProperties.toImmutable(), + ) + } - override fun toString() = value.toString() - } + @NoAutoDetect + class Tier + @JsonCreator + private constructor( + @JsonProperty("bps") + @ExcludeMissing + private val bps: JsonField = JsonMissing.of(), + @JsonProperty("maximum_amount") + @ExcludeMissing + private val maximumAmount: JsonField = JsonMissing.of(), + @JsonProperty("per_unit_maximum") + @ExcludeMissing + private val perUnitMaximum: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** Basis points to rate on */ + fun bps(): Double = bps.getRequired("bps") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** Upper bound for tier */ + fun maximumAmount(): Optional = + Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - companion object { + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(): Optional = + Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) - @JvmField val BULK_BPS = of("bulk_bps") + /** Basis points to rate on */ + @JsonProperty("bps") @ExcludeMissing fun _bps(): JsonField = bps - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + /** Upper bound for tier */ + @JsonProperty("maximum_amount") + @ExcludeMissing + fun _maximumAmount(): JsonField = maximumAmount - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_BPS, - } + /** The maximum amount to charge for any one event */ + @JsonProperty("per_unit_maximum") + @ExcludeMissing + fun _perUnitMaximum(): JsonField = perUnitMaximum - /** - * 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, - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 - } + private var validated: Boolean = false - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") - } + fun validate(): Tier = apply { + if (validated) { + return@apply + } - fun asString(): String = _value().asStringOrThrow() + bps() + maximumAmount() + perUnitMaximum() + validated = true + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun toBuilder() = Builder().from(this) - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + companion object { - override fun hashCode() = value.hashCode() + @JvmStatic fun builder() = Builder() + } - override fun toString() = value.toString() - } + /** A builder for [Tier]. */ + class Builder internal constructor() { - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var bps: JsonField? = null + private var maximumAmount: JsonField = JsonMissing.of() + private var perUnitMaximum: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = + mutableMapOf() - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmSynthetic + internal fun from(tier: Tier) = apply { + bps = tier.bps + maximumAmount = tier.maximumAmount + perUnitMaximum = tier.perUnitMaximum + additionalProperties = tier.additionalProperties.toMutableMap() + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** Basis points to rate on */ + fun bps(bps: Double) = bps(JsonField.of(bps)) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** Basis points to rate on */ + fun bps(bps: JsonField) = apply { this.bps = bps } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** Upper bound for tier */ + fun maximumAmount(maximumAmount: String?) = + maximumAmount(JsonField.ofNullable(maximumAmount)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** Upper bound for tier */ + fun maximumAmount(maximumAmount: Optional) = + maximumAmount(maximumAmount.orElse(null)) - private var validated: Boolean = false + /** Upper bound for tier */ + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply - } + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(perUnitMaximum: String?) = + perUnitMaximum(JsonField.ofNullable(perUnitMaximum)) - duration() - durationUnit() - validated = true - } + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(perUnitMaximum: Optional) = + perUnitMaximum(perUnitMaximum.orElse(null)) - fun toBuilder() = Builder().from(this) + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(perUnitMaximum: JsonField) = apply { + this.perUnitMaximum = perUnitMaximum + } - companion object { + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JvmStatic fun builder() = Builder() - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + fun build(): Tier = + Tier( + checkRequired("bps", bps), + maximumAmount, + perUnitMaximum, + additionalProperties.toImmutable(), + ) + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + return /* spotless:off */ other is Tier && bps == other.bps && maximumAmount == other.maximumAmount && perUnitMaximum == other.perUnitMaximum && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(bps, maximumAmount, perUnitMaximum, additionalProperties) } + /* spotless:on */ - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode(): Int = hashCode - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = + "Tier{bps=$bps, maximumAmount=$maximumAmount, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is BulkBpsConfig && tiers == other.tiers && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(tiers, additionalProperties) } + /* spotless:on */ - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "BulkBpsConfig{tiers=$tiers, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -13616,35 +13389,50 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val MONTHLY = of("monthly") + + @JvmField val QUARTERLY = of("quarterly") + + @JvmField val ONE_TIME = of("one_time") - @JvmField val MONTH = of("month") + @JvmField val CUSTOM = of("custom") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [Cadence]'s known values. */ enum class Known { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * An instance of [Cadence] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -13658,8 +13446,12 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM else -> Value._UNKNOWN } @@ -13674,166 +13466,32 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DurationUnit && 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 BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") - - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration - - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply - } - - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { - - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun asString(): String = _value().asStringOrThrow() - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode() = value.hashCode() - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun toString() = value.toString() } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -13847,35 +13505,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + @JvmField val BULK_BPS = of("bulk_bps") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + BULK_BPS } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + BULK_BPS, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -13889,8 +13542,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + BULK_BPS -> Value.BULK_BPS else -> Value._UNKNOWN } @@ -13905,9 +13557,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + BULK_BPS -> Known.BULK_BPS + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -13917,7 +13568,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -13925,674 +13576,784 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @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)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && 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 BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - override fun hashCode(): Int = hashCode + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - private var validated: Boolean = false + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the 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 validate(): Metadata = apply { - if (validated) { - return@apply - } + companion object { - validated = true - } + @JvmField val DAY = of("day") - fun toBuilder() = Builder().from(this) + @JvmField val MONTH = of("month") - companion object { + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmStatic fun builder() = Builder() - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] 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) { + DAY -> Value.DAY + MONTH -> Value.MONTH + 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) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun asString(): String = _value().asStringOrThrow() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + override fun hashCode() = value.hashCode() - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + override fun toString() = value.toString() } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + 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 InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - 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 */ - } + validated = true + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + fun toBuilder() = Builder().from(this) - override fun hashCode(): Int = hashCode + companion object { - 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}" - } + @JvmStatic fun builder() = Builder() + } - @NoAutoDetect - class NewFloatingBulkPrice - @JsonCreator - private constructor( - @JsonProperty("bulk_config") - @ExcludeMissing - private val bulkConfig: JsonField = JsonMissing.of(), - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** A builder for [Metadata]. */ + class Builder internal constructor() { - fun bulkConfig(): BulkConfig = bulkConfig.getRequired("bulk_config") + private var additionalProperties: MutableMap = mutableMapOf() - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - @JsonProperty("bulk_config") - @ExcludeMissing - fun _bulkConfig(): JsonField = bulkConfig - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - private var validated: Boolean = false + override fun hashCode(): Int = hashCode - fun validate(): NewFloatingBulkPrice = apply { - if (validated) { - return@apply + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - bulkConfig().validate() - cadence() - currency() - itemId() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + 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 */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - @JvmStatic fun builder() = Builder() + 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}" } - /** A builder for [NewFloatingBulkPrice]. */ - class Builder internal constructor() { - - private var bulkConfig: JsonField? = null - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } - - fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) - - fun bulkConfig(bulkConfig: JsonField) = apply { - this.bulkConfig = bulkConfig - } + @NoAutoDetect + class NewFloatingBulkPrice + @JsonCreator + private constructor( + @JsonProperty("bulk_config") + @ExcludeMissing + private val bulkConfig: JsonField = JsonMissing.of(), + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun bulkConfig(): BulkConfig = bulkConfig.getRequired("bulk_config") /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun currency(): String = currency.getRequired("currency") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + fun itemId(): String = itemId.getRequired("item_id") - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun name(): String = name.getRequired("name") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + @JsonProperty("bulk_config") + @ExcludeMissing + fun _bulkConfig(): JsonField = bulkConfig - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): NewFloatingBulkPrice = - NewFloatingBulkPrice( - checkRequired("bulkConfig", bulkConfig), - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } - - @NoAutoDetect - class BulkConfig - @JsonCreator - private constructor( - @JsonProperty("tiers") + @JsonProperty("metadata") @ExcludeMissing - private val tiers: JsonField> = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** Bulk tiers for rating based on total usage volume */ - fun tiers(): List = tiers.getRequired("tiers") - - /** Bulk tiers for rating based on total usage volume */ - @JsonProperty("tiers") @ExcludeMissing fun _tiers(): JsonField> = tiers + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -14600,12 +14361,26 @@ private constructor( private var validated: Boolean = false - fun validate(): BulkConfig = apply { + fun validate(): NewFloatingBulkPrice = apply { if (validated) { return@apply } - tiers().forEach { it.validate() } + bulkConfig().validate() + cadence() + currency() + itemId() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } validated = true } @@ -14616,554 +14391,590 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [BulkConfig]. */ + /** A builder for [NewFloatingBulkPrice]. */ class Builder internal constructor() { - private var tiers: JsonField>? = null + private var bulkConfig: JsonField? = null + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bulkConfig: BulkConfig) = apply { - tiers = bulkConfig.tiers.map { it.toMutableList() } - additionalProperties = bulkConfig.additionalProperties.toMutableMap() - } - - /** Bulk tiers for rating based on total usage volume */ - fun tiers(tiers: List) = tiers(JsonField.of(tiers)) - - /** Bulk tiers for rating based on total usage volume */ - fun tiers(tiers: JsonField>) = apply { - this.tiers = tiers.map { it.toMutableList() } - } - - /** Bulk tiers for rating based on total usage volume */ - fun addTier(tier: Tier) = apply { - tiers = - (tiers ?: JsonField.of(mutableListOf())).apply { - asKnown() - .orElseThrow { - IllegalStateException( - "Field was set to non-list type: ${javaClass.simpleName}" - ) - } - .add(tier) - } + 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() } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun bulkConfig(bulkConfig: JsonField) = apply { + this.bulkConfig = bulkConfig } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - fun build(): BulkConfig = - BulkConfig( - checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() - ) - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @NoAutoDetect - class Tier - @JsonCreator - private constructor( - @JsonProperty("unit_amount") - @ExcludeMissing - private val unitAmount: JsonField = JsonMissing.of(), - @JsonProperty("maximum_units") - @ExcludeMissing - private val maximumUnits: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - /** Amount per unit */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - /** Upper bound for this tier */ - fun maximumUnits(): Optional = - Optional.ofNullable(maximumUnits.getNullable("maximum_units")) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** Amount per unit */ - @JsonProperty("unit_amount") - @ExcludeMissing - fun _unitAmount(): JsonField = unitAmount + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - /** Upper bound for this tier */ - @JsonProperty("maximum_units") - @ExcludeMissing - fun _maximumUnits(): JsonField = maximumUnits + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - private var validated: Boolean = false + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - fun validate(): Tier = apply { - if (validated) { - return@apply - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - unitAmount() - maximumUnits() - validated = true + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - /** A builder for [Tier]. */ - class Builder internal constructor() { + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - private var unitAmount: JsonField? = null - private var maximumUnits: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - @JvmSynthetic - internal fun from(tier: Tier) = apply { - unitAmount = tier.unitAmount - maximumUnits = tier.maximumUnits - additionalProperties = tier.additionalProperties.toMutableMap() - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - /** Amount per unit */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - /** Amount per unit */ - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - /** Upper bound for this tier */ - fun maximumUnits(maximumUnits: Double?) = - maximumUnits(JsonField.ofNullable(maximumUnits)) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** Upper bound for this tier */ - fun maximumUnits(maximumUnits: Double) = maximumUnits(maximumUnits as Double?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** Upper bound for this tier */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun maximumUnits(maximumUnits: Optional) = - maximumUnits(maximumUnits.orElse(null) as Double?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** Upper bound for this tier */ - fun maximumUnits(maximumUnits: JsonField) = apply { - this.maximumUnits = maximumUnits - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - fun build(): Tier = - Tier( - checkRequired("unitAmount", unitAmount), - maximumUnits, - additionalProperties.toImmutable(), - ) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - return /* spotless:off */ other is Tier && unitAmount == other.unitAmount && maximumUnits == other.maximumUnits && additionalProperties == other.additionalProperties /* spotless:on */ + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unitAmount, maximumUnits, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - override fun toString() = - "Tier{unitAmount=$unitAmount, maximumUnits=$maximumUnits, additionalProperties=$additionalProperties}" - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } - return /* spotless:off */ other is BulkConfig && tiers == other.tiers && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(tiers, additionalProperties) } - /* spotless:on */ + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - override fun hashCode(): Int = hashCode + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - override fun toString() = - "BulkConfig{tiers=$tiers, additionalProperties=$additionalProperties}" - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** The cadence to bill for this price on. */ - class Cadence - @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`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - companion object { + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JvmField val ANNUAL = of("annual") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JvmField val SEMI_ANNUAL = of("semi_annual") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - @JvmField val MONTHLY = of("monthly") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - @JvmField val QUARTERLY = of("quarterly") + fun build(): NewFloatingBulkPrice = + NewFloatingBulkPrice( + checkRequired("bulkConfig", bulkConfig), + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) + } - @JvmField val ONE_TIME = of("one_time") + @NoAutoDetect + class BulkConfig + @JsonCreator + private constructor( + @JsonProperty("tiers") + @ExcludeMissing + private val tiers: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - @JvmField val CUSTOM = of("custom") + /** Bulk tiers for rating based on total usage volume */ + fun tiers(): List = tiers.getRequired("tiers") - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** Bulk tiers for rating based on total usage volume */ + @JsonProperty("tiers") @ExcludeMissing fun _tiers(): JsonField> = tiers - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + private var validated: Boolean = false - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + fun validate(): BulkConfig = apply { + if (validated) { + return@apply + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") + tiers().forEach { it.validate() } + validated = true } - fun asString(): String = _value().asStringOrThrow() + fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + companion object { + + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** A builder for [BulkConfig]. */ + class Builder internal constructor() { - override fun hashCode() = value.hashCode() + private var tiers: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun toString() = value.toString() - } + @JvmSynthetic + internal fun from(bulkConfig: BulkConfig) = apply { + tiers = bulkConfig.tiers.map { it.toMutableList() } + additionalProperties = bulkConfig.additionalProperties.toMutableMap() + } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** Bulk tiers for rating based on total usage volume */ + fun tiers(tiers: List) = tiers(JsonField.of(tiers)) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** Bulk tiers for rating based on total usage volume */ + fun tiers(tiers: JsonField>) = apply { + this.tiers = tiers.map { it.toMutableList() } + } - companion object { + /** Bulk tiers for rating based on total usage volume */ + fun addTier(tier: Tier) = apply { + tiers = + (tiers ?: JsonField.of(mutableListOf())).apply { + asKnown() + .orElseThrow { + IllegalStateException( + "Field was set to non-list type: ${javaClass.simpleName}" + ) + } + .add(tier) + } + } - @JvmField val BULK = of("bulk") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK, - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * 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, - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") + fun build(): BulkConfig = + BulkConfig( + checkRequired("tiers", tiers).map { it.toImmutable() }, + additionalProperties.toImmutable(), + ) } - fun asString(): String = _value().asStringOrThrow() + @NoAutoDetect + class Tier + @JsonCreator + private constructor( + @JsonProperty("unit_amount") + @ExcludeMissing + private val unitAmount: JsonField = JsonMissing.of(), + @JsonProperty("maximum_units") + @ExcludeMissing + private val maximumUnits: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** Amount per unit */ + fun unitAmount(): String = unitAmount.getRequired("unit_amount") - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + /** Upper bound for this tier */ + fun maximumUnits(): Optional = + Optional.ofNullable(maximumUnits.getNullable("maximum_units")) - override fun hashCode() = value.hashCode() + /** Amount per unit */ + @JsonProperty("unit_amount") + @ExcludeMissing + fun _unitAmount(): JsonField = unitAmount - override fun toString() = value.toString() - } + /** Upper bound for this tier */ + @JsonProperty("maximum_units") + @ExcludeMissing + fun _maximumUnits(): JsonField = maximumUnits - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + private var validated: Boolean = false - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + fun validate(): Tier = apply { + if (validated) { + return@apply + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + unitAmount() + maximumUnits() + validated = true + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + fun toBuilder() = Builder().from(this) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + companion object { - private var validated: Boolean = false + @JvmStatic fun builder() = Builder() + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply - } + /** A builder for [Tier]. */ + class Builder internal constructor() { - duration() - durationUnit() - validated = true - } + private var unitAmount: JsonField? = null + private var maximumUnits: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = + mutableMapOf() - fun toBuilder() = Builder().from(this) + @JvmSynthetic + internal fun from(tier: Tier) = apply { + unitAmount = tier.unitAmount + maximumUnits = tier.maximumUnits + additionalProperties = tier.additionalProperties.toMutableMap() + } - companion object { + /** Amount per unit */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - @JvmStatic fun builder() = Builder() - } + /** Amount per unit */ + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double?) = + maximumUnits(JsonField.ofNullable(maximumUnits)) - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double) = + maximumUnits(maximumUnits as Double?) - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + /** Upper bound for this tier */ + @Suppress( + "USELESS_CAST" + ) // See https://youtrack.jetbrains.com/issue/KT-74228 + fun maximumUnits(maximumUnits: Optional) = + maximumUnits(maximumUnits.orElse(null) as Double?) - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: JsonField) = apply { + this.maximumUnits = maximumUnits + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun build(): Tier = + Tier( + checkRequired("unitAmount", unitAmount), + maximumUnits, + additionalProperties.toImmutable(), + ) } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Tier && unitAmount == other.unitAmount && maximumUnits == other.maximumUnits && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(unitAmount, maximumUnits, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Tier{unitAmount=$unitAmount, maximumUnits=$maximumUnits, additionalProperties=$additionalProperties}" } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BulkConfig && tiers == other.tiers && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(tiers, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BulkConfig{tiers=$tiers, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -15177,35 +14988,50 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val MONTHLY = of("monthly") + + @JvmField val QUARTERLY = of("quarterly") - @JvmField val MONTH = of("month") + @JvmField val ONE_TIME = of("one_time") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [Cadence]'s known values. */ enum class Known { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * An instance of [Cadence] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -15216,185 +15042,55 @@ private constructor( * * Use the [known] method instead if you're certain the value is always known or if * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DurationUnit && 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 BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") - - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration - - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply - } - - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { - - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() - } - - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - 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) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun asString(): String = _value().asStringOrThrow() - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode() = value.hashCode() - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun toString() = value.toString() } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -15408,35 +15104,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val BULK = of("bulk") - @JvmField val MONTH = of("month") - - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + BULK } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + BULK, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -15450,8 +15141,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + BULK -> Value.BULK else -> Value._UNKNOWN } @@ -15466,9 +15156,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + BULK -> Known.BULK + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -15478,7 +15167,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -15486,915 +15175,1105 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @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)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && 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 BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - override fun hashCode(): Int = hashCode + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - private var validated: Boolean = false + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the 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 validate(): Metadata = apply { - if (validated) { - return@apply - } + companion object { - validated = true - } + @JvmField val DAY = of("day") - fun toBuilder() = Builder().from(this) + @JvmField val MONTH = of("month") - companion object { + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmStatic fun builder() = Builder() - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] 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) { + DAY -> Value.DAY + MONTH -> Value.MONTH + 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) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun asString(): String = _value().asStringOrThrow() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + override fun hashCode() = value.hashCode() - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + override fun toString() = value.toString() } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + 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 InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - 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 */ - } + validated = true + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(bulkConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + fun toBuilder() = Builder().from(this) - override fun hashCode(): Int = hashCode + companion object { - 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}" - } + @JvmStatic fun builder() = Builder() + } - @NoAutoDetect - class NewFloatingThresholdTotalAmountPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("threshold_total_amount_config") - @ExcludeMissing - private val thresholdTotalAmountConfig: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + private var additionalProperties: MutableMap = mutableMapOf() - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = - thresholdTotalAmountConfig.getRequired("threshold_total_amount_config") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("threshold_total_amount_config") - @ExcludeMissing - fun _thresholdTotalAmountConfig(): JsonField = - thresholdTotalAmountConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - private var validated: Boolean = false + override fun hashCode(): Int = hashCode - fun validate(): NewFloatingThresholdTotalAmountPrice = apply { - if (validated) { - return@apply + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - cadence() - currency() - itemId() - modelType() - name() - thresholdTotalAmountConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + 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 */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(bulkConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - @JvmStatic fun builder() = Builder() - } + override fun hashCode(): Int = hashCode - /** A builder for [NewFloatingThresholdTotalAmountPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var thresholdTotalAmountConfig: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + 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}" + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @NoAutoDetect + class NewFloatingThresholdTotalAmountPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("threshold_total_amount_config") + @ExcludeMissing + private val thresholdTotalAmountConfig: JsonField = + JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun currency(): String = currency.getRequired("currency") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun itemId(): String = itemId.getRequired("item_id") - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - fun thresholdTotalAmountConfig(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = - thresholdTotalAmountConfig(JsonField.of(thresholdTotalAmountConfig)) - - fun thresholdTotalAmountConfig( - thresholdTotalAmountConfig: JsonField - ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + fun name(): String = name.getRequired("name") - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = + thresholdTotalAmountConfig.getRequired("threshold_total_amount_config") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + @JsonProperty("threshold_total_amount_config") + @ExcludeMissing + fun _thresholdTotalAmountConfig(): JsonField = + thresholdTotalAmountConfig /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): NewFloatingThresholdTotalAmountPrice = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + cadence() + currency() + itemId() + modelType() + name() + thresholdTotalAmountConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): NewFloatingThresholdTotalAmountPrice = - NewFloatingThresholdTotalAmountPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired("thresholdTotalAmountConfig", thresholdTotalAmountConfig), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [NewFloatingThresholdTotalAmountPrice]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var thresholdTotalAmountConfig: JsonField? = + null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @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() + } - companion object { + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - @JvmField val ANNUAL = of("annual") + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - @JvmField val SEMI_ANNUAL = of("semi_annual") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - @JvmField val MONTHLY = of("monthly") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @JvmField val QUARTERLY = of("quarterly") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - @JvmField val ONE_TIME = of("one_time") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - @JvmField val CUSTOM = of("custom") + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + fun thresholdTotalAmountConfig( + thresholdTotalAmountConfig: ThresholdTotalAmountConfig + ) = thresholdTotalAmountConfig(JsonField.of(thresholdTotalAmountConfig)) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + fun thresholdTotalAmountConfig( + thresholdTotalAmountConfig: JsonField + ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - fun asString(): String = _value().asStringOrThrow() + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - override fun hashCode() = value.hashCode() + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - override fun toString() = value.toString() - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - companion object { + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - @JvmField val THRESHOLD_TOTAL_AMOUNT = of("threshold_total_amount") + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** An enum containing [ModelType]'s known values. */ - enum class Known { - THRESHOLD_TOTAL_AMOUNT, - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** - * 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, - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - fun asString(): String = _value().asStringOrThrow() + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - override fun hashCode() = value.hashCode() + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - override fun toString() = value.toString() - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @NoAutoDetect - class ThresholdTotalAmountConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - private var validated: Boolean = false + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - fun validate(): ThresholdTotalAmountConfig = apply { - if (validated) { - return@apply + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } - validated = true - } - - fun toBuilder() = Builder().from(this) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - companion object { + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - @JvmStatic fun builder() = Builder() - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** A builder for [ThresholdTotalAmountConfig]. */ - class Builder internal constructor() { + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - @JvmSynthetic - internal fun from(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = apply { - additionalProperties = - thresholdTotalAmountConfig.additionalProperties.toMutableMap() - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -16418,146 +16297,146 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): ThresholdTotalAmountConfig = - ThresholdTotalAmountConfig(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is ThresholdTotalAmountConfig && additionalProperties == other.additionalProperties /* spotless:on */ + fun build(): NewFloatingThresholdTotalAmountPrice = + NewFloatingThresholdTotalAmountPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired("thresholdTotalAmountConfig", thresholdTotalAmountConfig), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - override fun toString() = - "ThresholdTotalAmountConfig{additionalProperties=$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 - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmField val ANNUAL = of("annual") - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + @JvmField val SEMI_ANNUAL = of("semi_annual") - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + @JvmField val MONTHLY = of("monthly") - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + @JvmField val QUARTERLY = of("quarterly") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val ONE_TIME = of("one_time") - private var validated: Boolean = false + @JvmField val CUSTOM = of("custom") - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @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() + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun asString(): String = _value().asStringOrThrow() - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode() = value.hashCode() - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun toString() = value.toString() } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -16571,35 +16450,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + @JvmField val THRESHOLD_TOTAL_AMOUNT = of("threshold_total_amount") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + THRESHOLD_TOTAL_AMOUNT } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + THRESHOLD_TOTAL_AMOUNT, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -16613,8 +16487,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + THRESHOLD_TOTAL_AMOUNT -> Value.THRESHOLD_TOTAL_AMOUNT else -> Value._UNKNOWN } @@ -16629,9 +16502,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + THRESHOLD_TOTAL_AMOUNT -> Known.THRESHOLD_TOTAL_AMOUNT + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -16641,7 +16513,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -16649,1141 +16521,1185 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @NoAutoDetect + class ThresholdTotalAmountConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): ThresholdTotalAmountConfig = apply { + if (validated) { + return@apply + } + + validated = true } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [ThresholdTotalAmountConfig]. */ + class Builder internal constructor() { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var additionalProperties: MutableMap = mutableMapOf() - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmSynthetic + internal fun from(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = + apply { + additionalProperties = + thresholdTotalAmountConfig.additionalProperties.toMutableMap() + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - private var validated: Boolean = false + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun build(): ThresholdTotalAmountConfig = + ThresholdTotalAmountConfig(additionalProperties.toImmutable()) } - duration() - durationUnit() - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + return /* spotless:off */ other is ThresholdTotalAmountConfig && additionalProperties == other.additionalProperties /* spotless:on */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - @JvmStatic fun builder() = Builder() + override fun hashCode(): Int = hashCode + + override fun toString() = + "ThresholdTotalAmountConfig{additionalProperties=$additionalProperties}" } - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @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)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && 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 BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun duration(): Long = duration.getRequired("duration") /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - 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(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + duration() + durationUnit() + validated = true } - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + fun toBuilder() = Builder().from(this) - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmStatic fun builder() = Builder() + } - companion object { + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - @JvmField val DAY = of("day") + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - @JvmField val MONTH = of("month") + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$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 - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val DAY = of("day") - private var validated: Boolean = false + @JvmField val MONTH = of("month") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - validated = true - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - fun toBuilder() = Builder().from(this) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - @JvmStatic fun builder() = Builder() - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun asString(): String = _value().asStringOrThrow() - private var additionalProperties: MutableMap = mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + private var validated: Boolean = false - override fun hashCode(): Int = hashCode + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + validated = true + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun toBuilder() = Builder().from(this) - 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 */ - } + companion object { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, thresholdTotalAmountConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + @JvmStatic fun builder() = Builder() + } - override fun hashCode(): Int = hashCode + /** A builder for [Metadata]. */ + class Builder internal constructor() { - 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}" - } + private var additionalProperties: MutableMap = mutableMapOf() - @NoAutoDetect - class NewFloatingTieredPackagePrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("tiered_package_config") - @ExcludeMissing - private val tieredPackageConfig: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun tieredPackageConfig(): TieredPackageConfig = - tieredPackageConfig.getRequired("tiered_package_config") + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + override fun hashCode(): Int = hashCode - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("tiered_package_config") - @ExcludeMissing - fun _tieredPackageConfig(): JsonField = tieredPackageConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): NewFloatingTieredPackagePrice = apply { - if (validated) { - return@apply + 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 */ } - cadence() - currency() - itemId() - modelType() - name() - tieredPackageConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, thresholdTotalAmountConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - companion object { + override fun hashCode(): Int = hashCode - @JvmStatic fun builder() = Builder() + 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}" } - /** A builder for [NewFloatingTieredPackagePrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var tieredPackageConfig: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } - - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @NoAutoDetect + class NewFloatingTieredPackagePrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("tiered_package_config") + @ExcludeMissing + private val tieredPackageConfig: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun currency(): String = currency.getRequired("currency") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun itemId(): String = itemId.getRequired("item_id") - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = - tieredPackageConfig(JsonField.of(tieredPackageConfig)) - - fun tieredPackageConfig(tieredPackageConfig: JsonField) = apply { - this.tieredPackageConfig = tieredPackageConfig - } + fun name(): String = name.getRequired("name") - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun tieredPackageConfig(): TieredPackageConfig = + tieredPackageConfig.getRequired("tiered_package_config") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + @JsonProperty("tiered_package_config") + @ExcludeMissing + fun _tieredPackageConfig(): JsonField = tieredPackageConfig /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): NewFloatingTieredPackagePrice = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + cadence() + currency() + itemId() + modelType() + name() + tieredPackageConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): NewFloatingTieredPackagePrice = - NewFloatingTieredPackagePrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired("tieredPackageConfig", tieredPackageConfig), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } - - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { + /** A builder for [NewFloatingTieredPackagePrice]. */ + class Builder internal constructor() { - @JvmField val ANNUAL = of("annual") + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var tieredPackageConfig: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmField val SEMI_ANNUAL = of("semi_annual") + @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() + } - @JvmField val MONTHLY = of("monthly") + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - @JvmField val QUARTERLY = of("quarterly") + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - @JvmField val ONE_TIME = of("one_time") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - @JvmField val CUSTOM = of("custom") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - fun asString(): String = _value().asStringOrThrow() + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = + tieredPackageConfig(JsonField.of(tieredPackageConfig)) - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + fun tieredPackageConfig(tieredPackageConfig: JsonField) = + apply { + this.tieredPackageConfig = tieredPackageConfig + } - override fun hashCode() = value.hashCode() + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - override fun toString() = value.toString() - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - companion object { + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - @JvmField val TIERED_PACKAGE = of("tiered_package") + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_PACKAGE, - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - /** - * 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. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - _UNKNOWN, - } + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - fun asString(): String = _value().asStringOrThrow() + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - override fun hashCode() = value.hashCode() + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - override fun toString() = value.toString() - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - @NoAutoDetect - class TieredPackageConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - private var validated: Boolean = false + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - fun validate(): TieredPackageConfig = apply { - if (validated) { - return@apply + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity } - validated = true - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - fun toBuilder() = Builder().from(this) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - companion object { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - @JvmStatic fun builder() = Builder() - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** A builder for [TieredPackageConfig]. */ - class Builder internal constructor() { + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - @JvmSynthetic - internal fun from(tieredPackageConfig: TieredPackageConfig) = apply { - additionalProperties = tieredPackageConfig.additionalProperties.toMutableMap() - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -17807,146 +17723,146 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): TieredPackageConfig = - TieredPackageConfig(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ + fun build(): NewFloatingTieredPackagePrice = + NewFloatingTieredPackagePrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired("tieredPackageConfig", tieredPackageConfig), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - override fun toString() = - "TieredPackageConfig{additionalProperties=$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 - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmField val ANNUAL = of("annual") - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + @JvmField val SEMI_ANNUAL = of("semi_annual") - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + @JvmField val MONTHLY = of("monthly") - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + @JvmField val QUARTERLY = of("quarterly") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val ONE_TIME = of("one_time") - private var validated: Boolean = false + @JvmField val CUSTOM = of("custom") - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @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() + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode() = value.hashCode() - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun toString() = value.toString() } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -17960,35 +17876,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + @JvmField val TIERED_PACKAGE = of("tiered_package") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + TIERED_PACKAGE } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + TIERED_PACKAGE, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -18002,1089 +17913,1219 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + 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) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to 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 asString(): String = _value().asStringOrThrow() + + 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() + } + + @NoAutoDetect + class TieredPackageConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): TieredPackageConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TieredPackageConfig]. */ + class Builder internal constructor() { + + 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) } - fun asString(): String = _value().asStringOrThrow() + fun build(): TieredPackageConfig = + TieredPackageConfig(additionalProperties.toImmutable()) + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is DurationUnit && 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}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - private var validated: Boolean = false + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun asString(): String = _value().asStringOrThrow() - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - companion object { + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - @JvmField val DAY = of("day") + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - @JvmField val MONTH = of("month") + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, + fun toBuilder() = Builder().from(this) + + companion object { + + @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) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - fun asString(): String = _value().asStringOrThrow() + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$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 - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val DAY = of("day") - private var validated: Boolean = false + @JvmField val MONTH = of("month") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - validated = true - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - fun toBuilder() = Builder().from(this) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - @JvmStatic fun builder() = Builder() - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun asString(): String = _value().asStringOrThrow() - private var additionalProperties: MutableMap = mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - 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 */ - } + validated = true + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredPackageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + fun toBuilder() = Builder().from(this) - override fun hashCode(): Int = hashCode + companion object { - 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}" - } + @JvmStatic fun builder() = Builder() + } - @NoAutoDetect - class NewFloatingGroupedTieredPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("grouped_tiered_config") - @ExcludeMissing - private val groupedTieredConfig: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + private var additionalProperties: MutableMap = mutableMapOf() - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - fun groupedTieredConfig(): GroupedTieredConfig = - groupedTieredConfig.getRequired("grouped_tiered_config") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - @JsonProperty("grouped_tiered_config") - @ExcludeMissing - fun _groupedTieredConfig(): JsonField = groupedTieredConfig - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - private var validated: Boolean = false + override fun hashCode(): Int = hashCode - fun validate(): NewFloatingGroupedTieredPrice = apply { - if (validated) { - return@apply + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - cadence() - currency() - groupedTieredConfig().validate() - itemId() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + 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 */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredPackageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - @JvmStatic fun builder() = Builder() - } + override fun hashCode(): Int = hashCode - /** A builder for [NewFloatingGroupedTieredPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var groupedTieredConfig: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + 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}" + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @NoAutoDetect + class NewFloatingGroupedTieredPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("grouped_tiered_config") + @ExcludeMissing + private val groupedTieredConfig: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun currency(): String = currency.getRequired("currency") - fun groupedTieredConfig(groupedTieredConfig: GroupedTieredConfig) = - groupedTieredConfig(JsonField.of(groupedTieredConfig)) - - fun groupedTieredConfig(groupedTieredConfig: JsonField) = apply { - this.groupedTieredConfig = groupedTieredConfig - } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun groupedTieredConfig(): GroupedTieredConfig = + groupedTieredConfig.getRequired("grouped_tiered_config") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + fun itemId(): String = itemId.getRequired("item_id") - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun name(): String = name.getRequired("name") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + @JsonProperty("grouped_tiered_config") + @ExcludeMissing + fun _groupedTieredConfig(): JsonField = groupedTieredConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId + + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType + + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate + + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private var validated: Boolean = false + + fun validate(): NewFloatingGroupedTieredPrice = apply { + if (validated) { + return@apply + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) + cadence() + currency() + groupedTieredConfig().validate() + itemId() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + fun toBuilder() = Builder().from(this) + + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): NewFloatingGroupedTieredPrice = - NewFloatingGroupedTieredPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("groupedTieredConfig", groupedTieredConfig), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [NewFloatingGroupedTieredPrice]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var groupedTieredConfig: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @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() + } - companion object { + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - @JvmField val ANNUAL = of("annual") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @JvmField val SEMI_ANNUAL = of("semi_annual") + fun groupedTieredConfig(groupedTieredConfig: GroupedTieredConfig) = + groupedTieredConfig(JsonField.of(groupedTieredConfig)) - @JvmField val MONTHLY = of("monthly") + fun groupedTieredConfig(groupedTieredConfig: JsonField) = + apply { + this.groupedTieredConfig = groupedTieredConfig + } - @JvmField val QUARTERLY = of("quarterly") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - @JvmField val ONE_TIME = of("one_time") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - @JvmField val CUSTOM = of("custom") + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * The id of the billable metric for the price. Only needed if the price is + * usage-based. */ - _UNKNOWN, - } + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - fun asString(): String = _value().asStringOrThrow() + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - override fun hashCode() = value.hashCode() + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - override fun toString() = value.toString() - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - @NoAutoDetect - class GroupedTieredConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - private var validated: Boolean = false + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - fun validate(): GroupedTieredConfig = apply { - if (validated) { - return@apply + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate } - validated = true - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - fun toBuilder() = Builder().from(this) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - companion object { + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - @JvmStatic fun builder() = Builder() - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - /** A builder for [GroupedTieredConfig]. */ - class Builder internal constructor() { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @JvmSynthetic - internal fun from(groupedTieredConfig: GroupedTieredConfig) = apply { - additionalProperties = groupedTieredConfig.additionalProperties.toMutableMap() + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -19107,235 +19148,230 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedTieredConfig = - GroupedTieredConfig(additionalProperties.toImmutable()) + fun build(): NewFloatingGroupedTieredPrice = + NewFloatingGroupedTieredPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("groupedTieredConfig", groupedTieredConfig), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - return /* spotless:off */ other is GroupedTieredConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmField val ANNUAL = of("annual") - override fun toString() = - "GroupedTieredConfig{additionalProperties=$additionalProperties}" - } + @JvmField val SEMI_ANNUAL = of("semi_annual") - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + @JvmField val MONTHLY = of("monthly") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val QUARTERLY = of("quarterly") - companion object { + @JvmField val ONE_TIME = of("one_time") - @JvmField val GROUPED_TIERED = of("grouped_tiered") + @JvmField val CUSTOM = of("custom") - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED, - } + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } + + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - /** - * 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. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 - } + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") - } + fun asString(): String = _value().asStringOrThrow() - fun asString(): String = _value().asStringOrThrow() + 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 Cadence && value == other.value /* spotless:on */ } - 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. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + override fun hashCode() = value.hashCode() - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + override fun toString() = value.toString() + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + @NoAutoDetect + class GroupedTieredConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): GroupedTieredConfig = apply { + if (validated) { + return@apply + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + validated = true } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) + fun toBuilder() = Builder().from(this) - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmStatic fun builder() = Builder() + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** A builder for [GroupedTieredConfig]. */ + class Builder internal constructor() { - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + @JvmSynthetic + internal fun from(groupedTieredConfig: GroupedTieredConfig) = apply { + additionalProperties = + groupedTieredConfig.additionalProperties.toMutableMap() + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun build(): GroupedTieredConfig = + GroupedTieredConfig(additionalProperties.toImmutable()) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is GroupedTieredConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "GroupedTieredConfig{additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -19349,35 +19385,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val GROUPED_TIERED = of("grouped_tiered") - @JvmField val MONTH = of("month") - - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + GROUPED_TIERED } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + GROUPED_TIERED, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -19391,8 +19422,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + GROUPED_TIERED -> Value.GROUPED_TIERED else -> Value._UNKNOWN } @@ -19407,9 +19437,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + GROUPED_TIERED -> Known.GROUPED_TIERED + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -19419,7 +19448,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -19427,1059 +19456,1105 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + 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(): Long = duration.getRequired("duration") + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - duration() - durationUnit() - validated = true - } + override fun hashCode() = value.hashCode() - fun toBuilder() = Builder().from(this) + override fun toString() = value.toString() + } - companion object { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmStatic fun builder() = Builder() - } + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + override fun hashCode(): Int = hashCode - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() - } + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun duration(): Long = duration.getRequired("duration") /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - 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(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + duration() + durationUnit() + validated = true } - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + fun toBuilder() = Builder().from(this) - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmStatic fun builder() = Builder() + } - companion object { + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - @JvmField val DAY = of("day") + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - @JvmField val MONTH = of("month") + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$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 - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val DAY = of("day") - private var validated: Boolean = false + @JvmField val MONTH = of("month") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - validated = true - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - fun toBuilder() = Builder().from(this) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - @JvmStatic fun builder() = Builder() - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun asString(): String = _value().asStringOrThrow() - private var additionalProperties: MutableMap = mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - 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 */ - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedTieredConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + validated = true + } - override fun hashCode(): Int = hashCode + fun toBuilder() = Builder().from(this) - 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}" - } + companion object { - @NoAutoDetect - class NewFloatingMaxGroupTieredPackagePrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("max_group_tiered_package_config") - @ExcludeMissing - private val maxGroupTieredPackageConfig: JsonField = - JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + private var additionalProperties: MutableMap = mutableMapOf() - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun maxGroupTieredPackageConfig(): MaxGroupTieredPackageConfig = - maxGroupTieredPackageConfig.getRequired("max_group_tiered_package_config") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("max_group_tiered_package_config") - @ExcludeMissing - fun _maxGroupTieredPackageConfig(): JsonField = - maxGroupTieredPackageConfig - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - private var validated: Boolean = false + override fun hashCode(): Int = hashCode - fun validate(): NewFloatingMaxGroupTieredPackagePrice = apply { - if (validated) { - return@apply + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - cadence() - currency() - itemId() - maxGroupTieredPackageConfig().validate() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + 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 */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedTieredConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - @JvmStatic fun builder() = Builder() - } + override fun hashCode(): Int = hashCode - /** A builder for [NewFloatingMaxGroupTieredPackagePrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var maxGroupTieredPackageConfig: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + 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}" + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @NoAutoDetect + class NewFloatingMaxGroupTieredPackagePrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("max_group_tiered_package_config") + @ExcludeMissing + private val maxGroupTieredPackageConfig: JsonField = + JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun currency(): String = currency.getRequired("currency") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + fun itemId(): String = itemId.getRequired("item_id") - fun maxGroupTieredPackageConfig( - maxGroupTieredPackageConfig: MaxGroupTieredPackageConfig - ) = maxGroupTieredPackageConfig(JsonField.of(maxGroupTieredPackageConfig)) + fun maxGroupTieredPackageConfig(): MaxGroupTieredPackageConfig = + maxGroupTieredPackageConfig.getRequired("max_group_tiered_package_config") - fun maxGroupTieredPackageConfig( - maxGroupTieredPackageConfig: JsonField - ) = apply { this.maxGroupTieredPackageConfig = maxGroupTieredPackageConfig } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } + fun name(): String = name.getRequired("name") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + @JsonProperty("max_group_tiered_package_config") + @ExcludeMissing + fun _maxGroupTieredPackageConfig(): JsonField = + maxGroupTieredPackageConfig - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): NewFloatingMaxGroupTieredPackagePrice = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + cadence() + currency() + itemId() + maxGroupTieredPackageConfig().validate() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): NewFloatingMaxGroupTieredPackagePrice = - NewFloatingMaxGroupTieredPackagePrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("maxGroupTieredPackageConfig", maxGroupTieredPackageConfig), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [NewFloatingMaxGroupTieredPackagePrice]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var maxGroupTieredPackageConfig: JsonField? = + null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @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() + } - companion object { + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - @JvmField val ANNUAL = of("annual") + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - @JvmField val SEMI_ANNUAL = of("semi_annual") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - @JvmField val MONTHLY = of("monthly") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + fun maxGroupTieredPackageConfig( + maxGroupTieredPackageConfig: MaxGroupTieredPackageConfig + ) = maxGroupTieredPackageConfig(JsonField.of(maxGroupTieredPackageConfig)) + + fun maxGroupTieredPackageConfig( + maxGroupTieredPackageConfig: JsonField + ) = apply { this.maxGroupTieredPackageConfig = maxGroupTieredPackageConfig } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } + + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - @JvmField val QUARTERLY = of("quarterly") + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - @JvmField val ONE_TIME = of("one_time") + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - @JvmField val CUSTOM = of("custom") + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - fun asString(): String = _value().asStringOrThrow() + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - override fun hashCode() = value.hashCode() + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - override fun toString() = value.toString() - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @NoAutoDetect - class MaxGroupTieredPackageConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - private var validated: Boolean = false + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - fun validate(): MaxGroupTieredPackageConfig = apply { - if (validated) { - return@apply + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } - validated = true - } - - fun toBuilder() = Builder().from(this) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - companion object { + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - @JvmStatic fun builder() = Builder() - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** A builder for [MaxGroupTieredPackageConfig]. */ - class Builder internal constructor() { + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - @JvmSynthetic - internal fun from(maxGroupTieredPackageConfig: MaxGroupTieredPackageConfig) = - apply { - additionalProperties = - maxGroupTieredPackageConfig.additionalProperties.toMutableMap() - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -20503,235 +20578,231 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): MaxGroupTieredPackageConfig = - MaxGroupTieredPackageConfig(additionalProperties.toImmutable()) + fun build(): NewFloatingMaxGroupTieredPackagePrice = + NewFloatingMaxGroupTieredPackagePrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("maxGroupTieredPackageConfig", maxGroupTieredPackageConfig), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - return /* spotless:off */ other is MaxGroupTieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmField val ANNUAL = of("annual") - override fun toString() = - "MaxGroupTieredPackageConfig{additionalProperties=$additionalProperties}" - } + @JvmField val SEMI_ANNUAL = of("semi_annual") - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + @JvmField val MONTHLY = of("monthly") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val QUARTERLY = of("quarterly") - companion object { + @JvmField val ONE_TIME = of("one_time") - @JvmField val MAX_GROUP_TIERED_PACKAGE = of("max_group_tiered_package") + @JvmField val CUSTOM = of("custom") - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MAX_GROUP_TIERED_PACKAGE, - } + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } - /** - * 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. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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") + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, } - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - override fun hashCode() = value.hashCode() + fun asString(): String = _value().asStringOrThrow() - override fun toString() = value.toString() - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + override fun hashCode() = value.hashCode() - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + override fun toString() = value.toString() + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + @NoAutoDetect + class MaxGroupTieredPackageConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): MaxGroupTieredPackageConfig = apply { + if (validated) { + return@apply + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + validated = true } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) + fun toBuilder() = Builder().from(this) - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmStatic fun builder() = Builder() + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** A builder for [MaxGroupTieredPackageConfig]. */ + class Builder internal constructor() { - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + @JvmSynthetic + internal fun from(maxGroupTieredPackageConfig: MaxGroupTieredPackageConfig) = + apply { + additionalProperties = + maxGroupTieredPackageConfig.additionalProperties.toMutableMap() + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun build(): MaxGroupTieredPackageConfig = + MaxGroupTieredPackageConfig(additionalProperties.toImmutable()) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + return /* spotless:off */ other is MaxGroupTieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MaxGroupTieredPackageConfig{additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -20745,35 +20816,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val MAX_GROUP_TIERED_PACKAGE = of("max_group_tiered_package") - @JvmField val MONTH = of("month") - - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + MAX_GROUP_TIERED_PACKAGE } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + MAX_GROUP_TIERED_PACKAGE, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -20787,8 +20853,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + MAX_GROUP_TIERED_PACKAGE -> Value.MAX_GROUP_TIERED_PACKAGE else -> Value._UNKNOWN } @@ -20803,9 +20868,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + MAX_GROUP_TIERED_PACKAGE -> Known.MAX_GROUP_TIERED_PACKAGE + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -20815,7 +20879,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -20823,235 +20887,555 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - private var validated: Boolean = false + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && 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 BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - companion object { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmField val DAY = of("day") + private var validated: Boolean = false - @JvmField val MONTH = of("month") + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + validated = true } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + fun toBuilder() = Builder().from(this) - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, + companion object { + + @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) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @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) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - fun asString(): String = _value().asStringOrThrow() + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Metadata && 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() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -21059,1390 +21443,1427 @@ private constructor( return true } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + 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 */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, maxGroupTieredPackageConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + "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}" } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ @NoAutoDetect - class Metadata + class NewFloatingTieredWithMinimumPrice @JsonCreator private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("tiered_with_minimum_config") + @ExcludeMissing + private val tieredWithMinimumConfig: JsonField = + JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - validated = true - } + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") - fun toBuilder() = Builder().from(this) + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") - companion object { + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") - @JvmStatic fun builder() = Builder() - } + fun modelType(): ModelType = modelType.getRequired("model_type") - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** The name of the price. */ + fun name(): String = name.getRequired("name") - private var additionalProperties: MutableMap = mutableMapOf() + fun tieredWithMinimumConfig(): TieredWithMinimumConfig = + tieredWithMinimumConfig.getRequired("tiered_with_minimum_config") - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - override fun hashCode(): Int = hashCode + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - 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 */ - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, maxGroupTieredPackageConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + @JsonProperty("tiered_with_minimum_config") + @ExcludeMissing + fun _tieredWithMinimumConfig(): JsonField = + tieredWithMinimumConfig - override fun hashCode(): Int = hashCode + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId - 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}" - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance - @NoAutoDetect - class NewFloatingTieredWithMinimumPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("tiered_with_minimum_config") - @ExcludeMissing - private val tieredWithMinimumConfig: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - fun modelType(): ModelType = modelType.getRequired("model_type") + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - /** The name of the price. */ - fun name(): String = name.getRequired("name") + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration - fun tieredWithMinimumConfig(): TieredWithMinimumConfig = - tieredWithMinimumConfig.getRequired("tiered_with_minimum_config") + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + private var validated: Boolean = false - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + fun validate(): NewFloatingTieredWithMinimumPrice = apply { + if (validated) { + return@apply + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + cadence() + currency() + itemId() + modelType() + name() + tieredWithMinimumConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("tiered_with_minimum_config") - @ExcludeMissing - fun _tieredWithMinimumConfig(): JsonField = tieredWithMinimumConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): NewFloatingTieredWithMinimumPrice = apply { - if (validated) { - return@apply + @JvmStatic fun builder() = Builder() } - cadence() - currency() - itemId() - modelType() - name() - tieredWithMinimumConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) + /** A builder for [NewFloatingTieredWithMinimumPrice]. */ + class Builder internal constructor() { - companion object { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var tieredWithMinimumConfig: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmStatic fun builder() = Builder() - } + @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() + } - /** A builder for [NewFloatingTieredWithMinimumPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var tieredWithMinimumConfig: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } + fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = + tieredWithMinimumConfig(JsonField.of(tieredWithMinimumConfig)) - fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = - tieredWithMinimumConfig(JsonField.of(tieredWithMinimumConfig)) + fun tieredWithMinimumConfig( + tieredWithMinimumConfig: JsonField + ) = apply { this.tieredWithMinimumConfig = tieredWithMinimumConfig } - fun tieredWithMinimumConfig( - tieredWithMinimumConfig: JsonField - ) = apply { this.tieredWithMinimumConfig = tieredWithMinimumConfig } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - 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 { + keys.forEach(::removeAdditionalProperty) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun build(): NewFloatingTieredWithMinimumPrice = + NewFloatingTieredWithMinimumPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired("tieredWithMinimumConfig", tieredWithMinimumConfig), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - fun build(): NewFloatingTieredWithMinimumPrice = - NewFloatingTieredWithMinimumPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired("tieredWithMinimumConfig", tieredWithMinimumConfig), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + companion object { - companion object { + @JvmField val ANNUAL = of("annual") - @JvmField val ANNUAL = of("annual") + @JvmField val SEMI_ANNUAL = of("semi_annual") - @JvmField val SEMI_ANNUAL = of("semi_annual") + @JvmField val MONTHLY = of("monthly") - @JvmField val MONTHLY = of("monthly") + @JvmField val QUARTERLY = of("quarterly") - @JvmField val QUARTERLY = of("quarterly") + @JvmField val ONE_TIME = of("one_time") - @JvmField val ONE_TIME = of("one_time") + @JvmField val CUSTOM = of("custom") - @JvmField val CUSTOM = of("custom") + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + fun asString(): String = _value().asStringOrThrow() - fun asString(): String = _value().asStringOrThrow() + 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 Cadence && value == other.value /* spotless:on */ } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + override fun hashCode() = value.hashCode() - override fun hashCode() = value.hashCode() + override fun toString() = value.toString() + } - override fun toString() = value.toString() - } + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { - 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 - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + companion object { - companion object { + @JvmField val TIERED_WITH_MINIMUM = of("tiered_with_minimum") - @JvmField val TIERED_WITH_MINIMUM = of("tiered_with_minimum") + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } - @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. */ - 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, + } - /** - * 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. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - _UNKNOWN, - } + 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, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") - } + fun asString(): String = _value().asStringOrThrow() - fun asString(): String = _value().asStringOrThrow() + 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 ModelType && value == other.value /* spotless:on */ } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + override fun hashCode() = value.hashCode() - override fun hashCode() = value.hashCode() + override fun toString() = value.toString() + } - override fun toString() = value.toString() - } + @NoAutoDetect + class TieredWithMinimumConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - @NoAutoDetect - class TieredWithMinimumConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): TieredWithMinimumConfig = apply { + if (validated) { + return@apply + } - fun validate(): TieredWithMinimumConfig = apply { - if (validated) { - return@apply + validated = true } - validated = true - } + fun toBuilder() = Builder().from(this) - fun toBuilder() = Builder().from(this) + companion object { - companion object { + @JvmStatic fun builder() = Builder() + } - @JvmStatic fun builder() = Builder() - } + /** A builder for [TieredWithMinimumConfig]. */ + class Builder internal constructor() { - /** A builder for [TieredWithMinimumConfig]. */ - class Builder internal constructor() { + private var additionalProperties: MutableMap = mutableMapOf() - private var additionalProperties: MutableMap = mutableMapOf() + @JvmSynthetic + internal fun from(tieredWithMinimumConfig: TieredWithMinimumConfig) = apply { + additionalProperties = + tieredWithMinimumConfig.additionalProperties.toMutableMap() + } - @JvmSynthetic - internal fun from(tieredWithMinimumConfig: TieredWithMinimumConfig) = apply { - additionalProperties = - tieredWithMinimumConfig.additionalProperties.toMutableMap() - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - 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 { + keys.forEach(::removeAdditionalProperty) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun build(): TieredWithMinimumConfig = + TieredWithMinimumConfig(additionalProperties.toImmutable()) } - fun build(): TieredWithMinimumConfig = - TieredWithMinimumConfig(additionalProperties.toImmutable()) - } + 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 TieredWithMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - return /* spotless:off */ other is TieredWithMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - override fun hashCode(): Int = hashCode + override fun hashCode(): Int = hashCode - override fun toString() = - "TieredWithMinimumConfig{additionalProperties=$additionalProperties}" - } + override fun toString() = + "TieredWithMinimumConfig{additionalProperties=$additionalProperties}" + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - private var validated: Boolean = false + private var validated: Boolean = false - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - duration() - durationUnit() - validated = true - } + fun toBuilder() = Builder().from(this) - fun toBuilder() = Builder().from(this) + companion object { - companion object { + @JvmStatic fun builder() = Builder() + } - @JvmStatic fun builder() = Builder() - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - 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() + } - @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)) - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - 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 { + keys.forEach(::removeAdditionalProperty) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + companion object { - companion object { + @JvmField val DAY = of("day") - @JvmField val DAY = of("day") + @JvmField val MONTH = of("month") - @JvmField val MONTH = of("month") + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. */ - _UNKNOWN, - } + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + 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 DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - private var validated: Boolean = false + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - companion object { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmField val DAY = of("day") + private var validated: Boolean = false - @JvmField val MONTH = of("month") + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + validated = true } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + fun toBuilder() = Builder().from(this) - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, + companion object { + + @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) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @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) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - fun asString(): String = _value().asStringOrThrow() + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Metadata && 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() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -22450,1395 +22871,1430 @@ private constructor( return true } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredWithMinimumPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithMinimumConfig == other.tieredWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + "NewFloatingTieredWithMinimumPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredWithMinimumConfig=$tieredWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ @NoAutoDetect - class Metadata + class NewFloatingPackageWithAllocationPrice @JsonCreator private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("package_with_allocation_config") + @ExcludeMissing + private val packageWithAllocationConfig: JsonField = + JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") - private var validated: Boolean = false + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") - validated = true - } + fun modelType(): ModelType = modelType.getRequired("model_type") - fun toBuilder() = Builder().from(this) + /** The name of the price. */ + fun name(): String = name.getRequired("name") - companion object { + fun packageWithAllocationConfig(): PackageWithAllocationConfig = + packageWithAllocationConfig.getRequired("package_with_allocation_config") - @JvmStatic fun builder() = Builder() - } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId + + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType + + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonProperty("package_with_allocation_config") + @ExcludeMissing + fun _packageWithAllocationConfig(): JsonField = + packageWithAllocationConfig + + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate + + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun validate(): NewFloatingPackageWithAllocationPrice = apply { + if (validated) { + return@apply } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + cadence() + currency() + itemId() + modelType() + name() + packageWithAllocationConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + fun toBuilder() = Builder().from(this) - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmStatic fun builder() = Builder() } - 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 */ - } + /** A builder for [NewFloatingPackageWithAllocationPrice]. */ + class Builder internal constructor() { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var packageWithAllocationConfig: JsonField? = + null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - override fun hashCode(): Int = hashCode + @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() + } - 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}" - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - @NoAutoDetect - class NewFloatingPackageWithAllocationPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("package_with_allocation_config") - @ExcludeMissing - private val packageWithAllocationConfig: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - fun modelType(): ModelType = modelType.getRequired("model_type") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun packageWithAllocationConfig(): PackageWithAllocationConfig = - packageWithAllocationConfig.getRequired("package_with_allocation_config") + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + fun packageWithAllocationConfig( + packageWithAllocationConfig: PackageWithAllocationConfig + ) = packageWithAllocationConfig(JsonField.of(packageWithAllocationConfig)) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + fun packageWithAllocationConfig( + packageWithAllocationConfig: JsonField + ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("package_with_allocation_config") - @ExcludeMissing - fun _packageWithAllocationConfig(): JsonField = - packageWithAllocationConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - private var validated: Boolean = false + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - fun validate(): NewFloatingPackageWithAllocationPrice = apply { - if (validated) { - return@apply - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } - cadence() - currency() - itemId() - modelType() - name() - packageWithAllocationConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - fun toBuilder() = Builder().from(this) + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - companion object { + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - @JvmStatic fun builder() = Builder() - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - /** A builder for [NewFloatingPackageWithAllocationPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var packageWithAllocationConfig: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - fun packageWithAllocationConfig( - packageWithAllocationConfig: PackageWithAllocationConfig - ) = packageWithAllocationConfig(JsonField.of(packageWithAllocationConfig)) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - fun packageWithAllocationConfig( - packageWithAllocationConfig: JsonField - ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): NewFloatingPackageWithAllocationPrice = + NewFloatingPackageWithAllocationPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired("packageWithAllocationConfig", packageWithAllocationConfig), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + companion object { - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + @JvmField val ANNUAL = of("annual") - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JvmField val SEMI_ANNUAL = of("semi_annual") - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JvmField val MONTHLY = of("monthly") - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + @JvmField val QUARTERLY = of("quarterly") - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + @JvmField val ONE_TIME = of("one_time") - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + @JvmField val CUSTOM = of("custom") - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + fun asString(): String = _value().asStringOrThrow() - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + override fun hashCode() = value.hashCode() - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) + override fun toString() = value.toString() } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the 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 build(): NewFloatingPackageWithAllocationPrice = - NewFloatingPackageWithAllocationPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired("packageWithAllocationConfig", packageWithAllocationConfig), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + companion object { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + @JvmField val PACKAGE_WITH_ALLOCATION = of("package_with_allocation") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } - companion object { + /** An enum containing [ModelType]'s known values. */ + enum class Known { + PACKAGE_WITH_ALLOCATION + } - @JvmField val ANNUAL = of("annual") + /** + * 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, + } - @JvmField val SEMI_ANNUAL = of("semi_annual") + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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 + } - @JvmField val MONTHLY = of("monthly") + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to 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") + } - @JvmField val QUARTERLY = of("quarterly") + fun asString(): String = _value().asStringOrThrow() - @JvmField val ONE_TIME = of("one_time") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val CUSTOM = of("custom") + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + } - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + override fun hashCode() = value.hashCode() - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, + override fun toString() = value.toString() } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + @NoAutoDetect + class PackageWithAllocationConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = 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) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + private var validated: Boolean = false - fun asString(): String = _value().asStringOrThrow() + fun validate(): PackageWithAllocationConfig = apply { + if (validated) { + return@apply + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + validated = true } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - override fun hashCode() = value.hashCode() + companion object { - override fun toString() = value.toString() - } + @JvmStatic fun builder() = Builder() + } - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** A builder for [PackageWithAllocationConfig]. */ + class Builder internal constructor() { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(packageWithAllocationConfig: PackageWithAllocationConfig) = + apply { + additionalProperties = + packageWithAllocationConfig.additionalProperties.toMutableMap() + } - @JvmField val PACKAGE_WITH_ALLOCATION = of("package_with_allocation") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - PACKAGE_WITH_ALLOCATION, - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * 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, - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") + fun build(): PackageWithAllocationConfig = + PackageWithAllocationConfig(additionalProperties.toImmutable()) } - fun asString(): String = _value().asStringOrThrow() + 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 PackageWithAllocationConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - @NoAutoDetect - class PackageWithAllocationConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - fun validate(): PackageWithAllocationConfig = apply { - if (validated) { - return@apply - } + override fun hashCode(): Int = hashCode - validated = true + override fun toString() = + "PackageWithAllocationConfig{additionalProperties=$additionalProperties}" } - fun toBuilder() = Builder().from(this) - - companion object { + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - @JvmStatic fun builder() = Builder() - } + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - /** A builder for [PackageWithAllocationConfig]. */ - class Builder internal constructor() { + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - private var additionalProperties: MutableMap = mutableMapOf() + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - @JvmSynthetic - internal fun from(packageWithAllocationConfig: PackageWithAllocationConfig) = - apply { - additionalProperties = - packageWithAllocationConfig.additionalProperties.toMutableMap() - } + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - 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(): BillingCycleConfiguration = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + duration() + durationUnit() + validated = true } - fun build(): PackageWithAllocationConfig = - PackageWithAllocationConfig(additionalProperties.toImmutable()) - } + fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + companion object { + + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is PackageWithAllocationConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun hashCode(): Int = hashCode + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - override fun toString() = - "PackageWithAllocationConfig{additionalProperties=$additionalProperties}" - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - private var validated: Boolean = false + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun asString(): String = _value().asStringOrThrow() - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun asString(): String = _value().asStringOrThrow() + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + duration() + durationUnit() + validated = true } - override fun hashCode() = value.hashCode() + fun toBuilder() = Builder().from(this) - override fun toString() = value.toString() - } + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun hashCode(): Int = hashCode + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - private var validated: Boolean = false + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun asString(): String = _value().asStringOrThrow() - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - companion object { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmField val DAY = of("day") + private var validated: Boolean = false - @JvmField val MONTH = of("month") + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + validated = true } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + fun toBuilder() = Builder().from(this) - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, + companion object { + + @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) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @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) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - fun asString(): String = _value().asStringOrThrow() + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Metadata && 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() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -23846,1483 +24302,1436 @@ private constructor( return true } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingPackageWithAllocationPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, packageWithAllocationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + "NewFloatingPackageWithAllocationPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ @NoAutoDetect - class Metadata + class NewFloatingTieredPackageWithMinimumPrice @JsonCreator private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("tiered_package_with_minimum_config") + @ExcludeMissing + private val tieredPackageWithMinimumConfig: JsonField = + JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - validated = true - } + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") - fun toBuilder() = Builder().from(this) + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") - companion object { + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") - @JvmStatic fun builder() = Builder() - } + fun modelType(): ModelType = modelType.getRequired("model_type") - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** The name of the price. */ + fun name(): String = name.getRequired("name") - private var additionalProperties: MutableMap = mutableMapOf() + fun tieredPackageWithMinimumConfig(): TieredPackageWithMinimumConfig = + tieredPackageWithMinimumConfig.getRequired("tiered_package_with_minimum_config") - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - override fun hashCode(): Int = hashCode + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - 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 */ - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, packageWithAllocationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + @JsonProperty("tiered_package_with_minimum_config") + @ExcludeMissing + fun _tieredPackageWithMinimumConfig(): JsonField = + tieredPackageWithMinimumConfig - override fun hashCode(): Int = hashCode + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId - 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}" - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance - @NoAutoDetect - class NewFloatingTieredPackageWithMinimumPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("tiered_package_with_minimum_config") - @ExcludeMissing - private val tieredPackageWithMinimumConfig: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - fun modelType(): ModelType = modelType.getRequired("model_type") + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - /** The name of the price. */ - fun name(): String = name.getRequired("name") + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration - fun tieredPackageWithMinimumConfig(): TieredPackageWithMinimumConfig = - tieredPackageWithMinimumConfig.getRequired("tiered_package_with_minimum_config") + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + private var validated: Boolean = false - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + fun validate(): NewFloatingTieredPackageWithMinimumPrice = apply { + if (validated) { + return@apply + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + cadence() + currency() + itemId() + modelType() + name() + tieredPackageWithMinimumConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("tiered_package_with_minimum_config") - @ExcludeMissing - fun _tieredPackageWithMinimumConfig(): JsonField = - tieredPackageWithMinimumConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): NewFloatingTieredPackageWithMinimumPrice = apply { - if (validated) { - return@apply + @JvmStatic fun builder() = Builder() } - cadence() - currency() - itemId() - modelType() - name() - tieredPackageWithMinimumConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) + /** A builder for [NewFloatingTieredPackageWithMinimumPrice]. */ + class Builder internal constructor() { - companion object { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var tieredPackageWithMinimumConfig: + JsonField? = + null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmStatic fun builder() = Builder() - } + @JvmSynthetic + internal fun from( + newFloatingTieredPackageWithMinimumPrice: + NewFloatingTieredPackageWithMinimumPrice + ) = apply { + cadence = newFloatingTieredPackageWithMinimumPrice.cadence + currency = newFloatingTieredPackageWithMinimumPrice.currency + itemId = newFloatingTieredPackageWithMinimumPrice.itemId + modelType = newFloatingTieredPackageWithMinimumPrice.modelType + name = newFloatingTieredPackageWithMinimumPrice.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 + invoicingCycleConfiguration = + newFloatingTieredPackageWithMinimumPrice.invoicingCycleConfiguration + metadata = newFloatingTieredPackageWithMinimumPrice.metadata + additionalProperties = + newFloatingTieredPackageWithMinimumPrice.additionalProperties.toMutableMap() + } - /** A builder for [NewFloatingTieredPackageWithMinimumPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var tieredPackageWithMinimumConfig: JsonField? = - null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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 - tieredPackageWithMinimumConfig = - newFloatingTieredPackageWithMinimumPrice.tieredPackageWithMinimumConfig - billableMetricId = newFloatingTieredPackageWithMinimumPrice.billableMetricId - billedInAdvance = newFloatingTieredPackageWithMinimumPrice.billedInAdvance - billingCycleConfiguration = - newFloatingTieredPackageWithMinimumPrice.billingCycleConfiguration - conversionRate = newFloatingTieredPackageWithMinimumPrice.conversionRate - externalPriceId = newFloatingTieredPackageWithMinimumPrice.externalPriceId - fixedPriceQuantity = newFloatingTieredPackageWithMinimumPrice.fixedPriceQuantity - invoiceGroupingKey = newFloatingTieredPackageWithMinimumPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingTieredPackageWithMinimumPrice.invoicingCycleConfiguration - metadata = newFloatingTieredPackageWithMinimumPrice.metadata - additionalProperties = - newFloatingTieredPackageWithMinimumPrice.additionalProperties.toMutableMap() - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } + fun tieredPackageWithMinimumConfig( + tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig + ) = tieredPackageWithMinimumConfig(JsonField.of(tieredPackageWithMinimumConfig)) - fun tieredPackageWithMinimumConfig( - tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig - ) = tieredPackageWithMinimumConfig(JsonField.of(tieredPackageWithMinimumConfig)) + fun tieredPackageWithMinimumConfig( + tieredPackageWithMinimumConfig: JsonField + ) = apply { this.tieredPackageWithMinimumConfig = tieredPackageWithMinimumConfig } - fun tieredPackageWithMinimumConfig( - tieredPackageWithMinimumConfig: JsonField - ) = apply { this.tieredPackageWithMinimumConfig = tieredPackageWithMinimumConfig } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - 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 { + keys.forEach(::removeAdditionalProperty) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun build(): NewFloatingTieredPackageWithMinimumPrice = + NewFloatingTieredPackageWithMinimumPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired( + "tieredPackageWithMinimumConfig", + tieredPackageWithMinimumConfig, + ), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - fun build(): NewFloatingTieredPackageWithMinimumPrice = - NewFloatingTieredPackageWithMinimumPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired("tieredPackageWithMinimumConfig", tieredPackageWithMinimumConfig), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + companion object { - companion object { + @JvmField val ANNUAL = of("annual") - @JvmField val ANNUAL = of("annual") + @JvmField val SEMI_ANNUAL = of("semi_annual") - @JvmField val SEMI_ANNUAL = of("semi_annual") + @JvmField val MONTHLY = of("monthly") - @JvmField val MONTHLY = of("monthly") + @JvmField val QUARTERLY = of("quarterly") - @JvmField val QUARTERLY = of("quarterly") + @JvmField val ONE_TIME = of("one_time") - @JvmField val ONE_TIME = of("one_time") + @JvmField val CUSTOM = of("custom") - @JvmField val CUSTOM = of("custom") + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - _UNKNOWN, - } + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + fun asString(): String = _value().asStringOrThrow() - fun asString(): String = _value().asStringOrThrow() + 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 Cadence && value == other.value /* spotless:on */ } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + override fun hashCode() = value.hashCode() - override fun hashCode() = value.hashCode() + override fun toString() = value.toString() + } - override fun toString() = value.toString() - } + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { - 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 - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + companion object { - companion object { + @JvmField val TIERED_PACKAGE_WITH_MINIMUM = of("tiered_package_with_minimum") - @JvmField val TIERED_PACKAGE_WITH_MINIMUM = of("tiered_package_with_minimum") + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } - @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. */ - 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, + } - /** - * 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. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - _UNKNOWN, - } + 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, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") - } + fun asString(): String = _value().asStringOrThrow() - fun asString(): String = _value().asStringOrThrow() + 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 ModelType && value == other.value /* spotless:on */ } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + override fun hashCode() = value.hashCode() - override fun hashCode() = value.hashCode() + override fun toString() = value.toString() + } - override fun toString() = value.toString() - } + @NoAutoDetect + class TieredPackageWithMinimumConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - @NoAutoDetect - class TieredPackageWithMinimumConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): TieredPackageWithMinimumConfig = apply { + if (validated) { + return@apply + } - fun validate(): TieredPackageWithMinimumConfig = apply { - if (validated) { - return@apply + validated = true } - validated = true - } - - fun toBuilder() = Builder().from(this) + fun toBuilder() = Builder().from(this) - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmStatic fun builder() = Builder() + } - /** A builder for [TieredPackageWithMinimumConfig]. */ - class Builder internal constructor() { + /** A builder for [TieredPackageWithMinimumConfig]. */ + class Builder internal constructor() { - private var additionalProperties: MutableMap = mutableMapOf() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmSynthetic - internal fun from(tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig) = - apply { + @JvmSynthetic + internal fun from( + tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig + ) = apply { additionalProperties = tieredPackageWithMinimumConfig.additionalProperties.toMutableMap() } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + 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 { + keys.forEach(::removeAdditionalProperty) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun build(): TieredPackageWithMinimumConfig = + TieredPackageWithMinimumConfig(additionalProperties.toImmutable()) } - fun build(): TieredPackageWithMinimumConfig = - TieredPackageWithMinimumConfig(additionalProperties.toImmutable()) - } + 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 TieredPackageWithMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - return /* spotless:off */ other is TieredPackageWithMinimumConfig && 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() = + "TieredPackageWithMinimumConfig{additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - override fun hashCode(): Int = hashCode + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - override fun toString() = - "TieredPackageWithMinimumConfig{additionalProperties=$additionalProperties}" - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + private var validated: Boolean = false - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + duration() + durationUnit() + validated = true + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + @JvmStatic fun builder() = Builder() } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - @JvmStatic fun builder() = Builder() - } + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - @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: JsonField) = apply { this.duration = duration } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val DAY = of("day") - companion object { + @JvmField val MONTH = of("month") - @JvmField val DAY = of("day") + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmField val MONTH = of("month") + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. */ - _UNKNOWN, - } + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + fun asString(): String = _value().asStringOrThrow() - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + 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 DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - override fun hashCode(): Int = hashCode + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + private var validated: Boolean = false - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + duration() + durationUnit() + validated = true + } - private var validated: Boolean = false + fun toBuilder() = Builder().from(this) - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + companion object { + + @JvmStatic fun builder() = Builder() } - duration() - durationUnit() - validated = true - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - fun toBuilder() = Builder().from(this) + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - @JvmStatic fun builder() = Builder() - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val DAY = of("day") - companion object { + @JvmField val MONTH = of("month") - @JvmField val DAY = of("day") + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmField val MONTH = of("month") + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. */ - _UNKNOWN, - } + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + fun asString(): String = _value().asStringOrThrow() - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + 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 DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + validated = true + } - private var validated: Boolean = false + fun toBuilder() = Builder().from(this) - fun validate(): Metadata = apply { - if (validated) { - return@apply + companion object { + + @JvmStatic fun builder() = Builder() } - validated = true - } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - fun toBuilder() = Builder().from(this) + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - @JvmStatic fun builder() = Builder() - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - private var additionalProperties: MutableMap = mutableMapOf() + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -25330,788 +25739,229 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingTieredPackageWithMinimumPrice && cadence == other.cadence && currency == other.currency && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredPackageWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - 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 */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredPackageWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "NewFloatingTieredPackageWithMinimumPrice{cadence=$cadence, currency=$currency, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" - } - - @NoAutoDetect - class NewFloatingUnitWithPercentPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("unit_with_percent_config") - @ExcludeMissing - private val unitWithPercentConfig: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") - - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") - - fun modelType(): ModelType = modelType.getRequired("model_type") - - /** The name of the price. */ - fun name(): String = name.getRequired("name") - - fun unitWithPercentConfig(): UnitWithPercentConfig = - unitWithPercentConfig.getRequired("unit_with_percent_config") - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("unit_with_percent_config") - @ExcludeMissing - fun _unitWithPercentConfig(): JsonField = unitWithPercentConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): NewFloatingUnitWithPercentPrice = apply { - if (validated) { - return@apply - } - - cadence() - currency() - itemId() - modelType() - name() - unitWithPercentConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() + 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}" } - /** A builder for [NewFloatingUnitWithPercentPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var unitWithPercentConfig: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } - - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @NoAutoDetect + class NewFloatingUnitWithPercentPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("unit_with_percent_config") + @ExcludeMissing + private val unitWithPercentConfig: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun currency(): String = currency.getRequired("currency") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun itemId(): String = itemId.getRequired("item_id") - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = - unitWithPercentConfig(JsonField.of(unitWithPercentConfig)) - - fun unitWithPercentConfig(unitWithPercentConfig: JsonField) = - apply { - this.unitWithPercentConfig = unitWithPercentConfig - } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + fun name(): String = name.getRequired("name") - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun unitWithPercentConfig(): UnitWithPercentConfig = + unitWithPercentConfig.getRequired("unit_with_percent_config") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } - - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) - - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): NewFloatingUnitWithPercentPrice = - NewFloatingUnitWithPercentPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired("unitWithPercentConfig", unitWithPercentConfig), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } - - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the 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 metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - companion object { - - @JvmField val ANNUAL = of("annual") - - @JvmField val SEMI_ANNUAL = of("semi_annual") - - @JvmField val MONTHLY = of("monthly") + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - @JvmField val QUARTERLY = of("quarterly") + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - @JvmField val ONE_TIME = of("one_time") + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - @JvmField val CUSTOM = of("custom") + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + @JsonProperty("unit_with_percent_config") + @ExcludeMissing + fun _unitWithPercentConfig(): JsonField = unitWithPercentConfig /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - override fun toString() = value.toString() - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - @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, - } + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * 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, - } + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun value(): Value = - when (this) { - UNIT_WITH_PERCENT -> Value.UNIT_WITH_PERCENT - else -> Value._UNKNOWN - } + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun known(): Known = - when (this) { - UNIT_WITH_PERCENT -> Known.UNIT_WITH_PERCENT - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - 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() - } - - @NoAutoDetect - class UnitWithPercentConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -26119,11 +25969,26 @@ private constructor( private var validated: Boolean = false - fun validate(): UnitWithPercentConfig = apply { + fun validate(): NewFloatingUnitWithPercentPrice = apply { if (validated) { return@apply } + cadence() + currency() + itemId() + modelType() + name() + unitWithPercentConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } validated = true } @@ -26134,141 +25999,285 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UnitWithPercentConfig]. */ + /** A builder for [NewFloatingUnitWithPercentPrice]. */ class Builder internal constructor() { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var unitWithPercentConfig: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(unitWithPercentConfig: UnitWithPercentConfig) = apply { - additionalProperties = unitWithPercentConfig.additionalProperties.toMutableMap() + 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() } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType } - fun putAllAdditionalProperties(additionalProperties: Map) = + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } + + fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = + unitWithPercentConfig(JsonField.of(unitWithPercentConfig)) + + fun unitWithPercentConfig(unitWithPercentConfig: JsonField) = apply { - this.additionalProperties.putAll(additionalProperties) + this.unitWithPercentConfig = unitWithPercentConfig } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - fun build(): UnitWithPercentConfig = - UnitWithPercentConfig(additionalProperties.toImmutable()) - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - return /* spotless:off */ other is UnitWithPercentConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - override fun hashCode(): Int = hashCode + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - override fun toString() = - "UnitWithPercentConfig{additionalProperties=$additionalProperties}" - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - private var validated: Boolean = false + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } - duration() - durationUnit() - validated = true - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - fun toBuilder() = Builder().from(this) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - companion object { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @JvmStatic fun builder() = Builder() - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26292,20 +26301,30 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), + fun build(): NewFloatingUnitWithPercentPrice = + NewFloatingUnitWithPercentPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired("unitWithPercentConfig", unitWithPercentConfig), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -26319,35 +26338,50 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val MONTHLY = of("monthly") + + @JvmField val QUARTERLY = of("quarterly") - @JvmField val MONTH = of("month") + @JvmField val ONE_TIME = of("one_time") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [Cadence]'s known values. */ enum class Known { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * An instance of [Cadence] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -26361,8 +26395,12 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM else -> Value._UNKNOWN } @@ -26377,9 +26415,13 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") } fun asString(): String = _value().asStringOrThrow() @@ -26389,7 +26431,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -26397,146 +26439,8 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") - - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration - - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply - } - - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { - - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() - } - - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } - - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -26550,35 +26454,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val UNIT_WITH_PERCENT = of("unit_with_percent") - @JvmField val MONTH = of("month") - - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + UNIT_WITH_PERCENT } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + UNIT_WITH_PERCENT, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -26592,8 +26491,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + UNIT_WITH_PERCENT -> Value.UNIT_WITH_PERCENT else -> Value._UNKNOWN } @@ -26608,903 +26506,890 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + UNIT_WITH_PERCENT -> Known.UNIT_WITH_PERCENT + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + 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() + } + + @NoAutoDetect + class UnitWithPercentConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): UnitWithPercentConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UnitWithPercentConfig]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(unitWithPercentConfig: UnitWithPercentConfig) = apply { + additionalProperties = + unitWithPercentConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - fun asString(): String = _value().asStringOrThrow() + fun build(): UnitWithPercentConfig = + UnitWithPercentConfig(additionalProperties.toImmutable()) + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is UnitWithPercentConfig && 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() = + "UnitWithPercentConfig{additionalProperties=$additionalProperties}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - override fun hashCode(): Int = hashCode + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } - fun validate(): Metadata = apply { - if (validated) { - return@apply + duration() + durationUnit() + validated = true } - validated = true - } + fun toBuilder() = Builder().from(this) - fun toBuilder() = Builder().from(this) + companion object { - companion object { + @JvmStatic fun builder() = Builder() + } - @JvmStatic fun builder() = Builder() - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** A builder for [Metadata]. */ - class Builder internal constructor() { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - private var additionalProperties: MutableMap = mutableMapOf() + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /** The unit of billing period duration. */ + class DurationUnit + @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 + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } - override fun hashCode(): Int = hashCode + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + override fun hashCode(): Int = hashCode - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - 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 */ - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, unitWithPercentConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - override fun hashCode(): Int = hashCode + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - 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}" - } + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - @NoAutoDetect - class NewFloatingTieredWithProrationPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("tiered_with_proration_config") - @ExcludeMissing - private val tieredWithProrationConfig: JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + private var validated: Boolean = false - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + duration() + durationUnit() + validated = true + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun toBuilder() = Builder().from(this) - /** The name of the price. */ - fun name(): String = name.getRequired("name") + companion object { - fun tieredWithProrationConfig(): TieredWithProrationConfig = - tieredWithProrationConfig.getRequired("tiered_with_proration_config") + @JvmStatic fun builder() = Builder() + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("tiered_with_proration_config") - @ExcludeMissing - fun _tieredWithProrationConfig(): JsonField = - tieredWithProrationConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - private var validated: Boolean = false + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - fun validate(): NewFloatingTieredWithProrationPrice = apply { - if (validated) { - return@apply - } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - cadence() - currency() - itemId() - modelType() - name() - tieredWithProrationConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun toBuilder() = Builder().from(this) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - companion object { + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JvmStatic fun builder() = Builder() - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** A builder for [NewFloatingTieredWithProrationPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var tieredWithProrationConfig: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + companion object { - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + @JvmField val DAY = of("day") - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + @JvmField val MONTH = of("month") - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - fun tieredWithProrationConfig(tieredWithProrationConfig: TieredWithProrationConfig) = - tieredWithProrationConfig(JsonField.of(tieredWithProrationConfig)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - fun tieredWithProrationConfig( - tieredWithProrationConfig: JsonField - ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + fun asString(): String = _value().asStringOrThrow() - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + override fun hashCode() = value.hashCode() - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + override fun toString() = value.toString() + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + override fun hashCode(): Int = hashCode - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + private var validated: Boolean = false - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + validated = true + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + fun toBuilder() = Builder().from(this) - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + companion object { - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + @JvmStatic fun builder() = Builder() + } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + private var additionalProperties: MutableMap = mutableMapOf() - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + override fun hashCode(): Int = hashCode - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) + 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 */ } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, unitWithPercentConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode(): Int = hashCode - fun build(): NewFloatingTieredWithProrationPrice = - NewFloatingTieredWithProrationPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired("tieredWithProrationConfig", tieredWithProrationConfig), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) + 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}" } - /** The cadence to bill for this price on. */ - class Cadence + @NoAutoDetect + class NewFloatingTieredWithProrationPrice @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ANNUAL = of("annual") - - @JvmField val SEMI_ANNUAL = of("semi_annual") + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("tiered_with_proration_config") + @ExcludeMissing + private val tieredWithProrationConfig: JsonField = + JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - @JvmField val MONTHLY = of("monthly") + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") - @JvmField val QUARTERLY = of("quarterly") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") - @JvmField val ONE_TIME = of("one_time") + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") - @JvmField val CUSTOM = of("custom") + fun modelType(): ModelType = modelType.getRequired("model_type") - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** The name of the price. */ + fun name(): String = name.getRequired("name") - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + fun tieredWithProrationConfig(): TieredWithProrationConfig = + tieredWithProrationConfig.getRequired("tiered_with_proration_config") /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } - - fun asString(): String = _value().asStringOrThrow() + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - override fun hashCode() = value.hashCode() + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - override fun toString() = value.toString() - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - companion object { + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - @JvmField val TIERED_WITH_PRORATION = of("tiered_with_proration") + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An enum containing [ModelType]'s known values. */ - enum class Known { - TIERED_WITH_PRORATION, - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType + + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonProperty("tiered_with_proration_config") + @ExcludeMissing + fun _tieredWithProrationConfig(): JsonField = + tieredWithProrationConfig /** - * 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. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - enum class Value { - TIERED_WITH_PRORATION, - /** - * An enum member indicating that [ModelType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - fun value(): Value = - when (this) { - TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION - else -> Value._UNKNOWN - } + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun known(): Known = - when (this) { - TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - fun asString(): String = _value().asStringOrThrow() + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - override fun hashCode() = value.hashCode() + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - override fun toString() = value.toString() - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration - @NoAutoDetect - class TieredWithProrationConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -27512,11 +27397,26 @@ private constructor( private var validated: Boolean = false - fun validate(): TieredWithProrationConfig = apply { + fun validate(): NewFloatingTieredWithProrationPrice = apply { if (validated) { return@apply } + cadence() + currency() + itemId() + modelType() + name() + tieredWithProrationConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } validated = true } @@ -27527,142 +27427,286 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [TieredWithProrationConfig]. */ + /** A builder for [NewFloatingTieredWithProrationPrice]. */ class Builder internal constructor() { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var tieredWithProrationConfig: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredWithProrationConfig: TieredWithProrationConfig) = apply { + 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 = - tieredWithProrationConfig.additionalProperties.toMutableMap() + newFloatingTieredWithProrationPrice.additionalProperties.toMutableMap() } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType } - fun build(): TieredWithProrationConfig = - TieredWithProrationConfig(additionalProperties.toImmutable()) - } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } + + fun tieredWithProrationConfig( + tieredWithProrationConfig: TieredWithProrationConfig + ) = tieredWithProrationConfig(JsonField.of(tieredWithProrationConfig)) + + fun tieredWithProrationConfig( + tieredWithProrationConfig: JsonField + ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - return /* spotless:off */ other is TieredWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - override fun hashCode(): Int = hashCode + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - override fun toString() = - "TieredWithProrationConfig{additionalProperties=$additionalProperties}" - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - private var validated: Boolean = false + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } - duration() - durationUnit() - validated = true - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - fun toBuilder() = Builder().from(this) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - companion object { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @JvmStatic fun builder() = Builder() - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -27686,20 +27730,30 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), + fun build(): NewFloatingTieredWithProrationPrice = + NewFloatingTieredWithProrationPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired("tieredWithProrationConfig", tieredWithProrationConfig), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -27713,35 +27767,50 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val MONTHLY = of("monthly") - @JvmField val MONTH = of("month") + @JvmField val QUARTERLY = of("quarterly") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmField val ONE_TIME = of("one_time") + + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [Cadence]'s known values. */ enum class Known { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * An instance of [Cadence] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -27755,8 +27824,12 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM else -> Value._UNKNOWN } @@ -27768,169 +27841,35 @@ private constructor( * * @throws OrbInvalidDataException if this class instance's value is a not a known * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is DurationUnit && 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 BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") - - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration - - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply - } - - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { - - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() - } - - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun asString(): String = _value().asStringOrThrow() - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode() = value.hashCode() - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun toString() = value.toString() } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -27944,35 +27883,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + @JvmField val TIERED_WITH_PRORATION = of("tiered_with_proration") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + TIERED_WITH_PRORATION } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + TIERED_WITH_PRORATION, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -27986,8 +27920,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION else -> Value._UNKNOWN } @@ -28002,9 +27935,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -28014,7 +27946,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -28022,880 +27954,872 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @NoAutoDetect + class TieredWithProrationConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): TieredWithProrationConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TieredWithProrationConfig]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tieredWithProrationConfig: TieredWithProrationConfig) = + apply { + additionalProperties = + tieredWithProrationConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): TieredWithProrationConfig = + TieredWithProrationConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TieredWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && 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() = + "TieredWithProrationConfig{additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - override fun hashCode(): Int = hashCode + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @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)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && 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 BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - private var validated: Boolean = false + private var validated: Boolean = false - fun validate(): Metadata = apply { - if (validated) { - return@apply + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - validated = true - } + fun toBuilder() = Builder().from(this) - fun toBuilder() = Builder().from(this) + companion object { - companion object { + @JvmStatic fun builder() = Builder() + } - @JvmStatic fun builder() = Builder() - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /** A builder for [Metadata]. */ - class Builder internal constructor() { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - private var additionalProperties: MutableMap = mutableMapOf() + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - override fun hashCode(): Int = hashCode + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + /** The unit of billing period duration. */ + class DurationUnit + @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 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 */ - } + companion object { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + @JvmField val DAY = of("day") - override fun hashCode(): Int = hashCode + @JvmField val MONTH = of("month") - 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}" - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @NoAutoDetect - class NewFloatingUnitWithProrationPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("unit_with_proration_config") - @ExcludeMissing - private val unitWithProrationConfig: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun asString(): String = _value().asStringOrThrow() - /** The name of the price. */ - fun name(): String = name.getRequired("name") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun unitWithProrationConfig(): UnitWithProrationConfig = - unitWithProrationConfig.getRequired("unit_with_proration_config") + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + override fun hashCode() = value.hashCode() - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + override fun toString() = value.toString() + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("unit_with_proration_config") - @ExcludeMissing - fun _unitWithProrationConfig(): JsonField = unitWithProrationConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - private var validated: Boolean = false + override fun hashCode(): Int = hashCode - fun validate(): NewFloatingUnitWithProrationPrice = apply { - if (validated) { - return@apply + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - cadence() - currency() - itemId() - modelType() - name() - unitWithProrationConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - fun toBuilder() = Builder().from(this) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - companion object { + private var validated: Boolean = false - @JvmStatic fun builder() = Builder() - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - /** A builder for [NewFloatingUnitWithProrationPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var unitWithProrationConfig: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + validated = true + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun toBuilder() = Builder().from(this) - /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + companion object { - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + @JvmStatic fun builder() = Builder() + } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + private var additionalProperties: MutableMap = mutableMapOf() - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = - unitWithProrationConfig(JsonField.of(unitWithProrationConfig)) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun unitWithProrationConfig( - unitWithProrationConfig: JsonField - ) = apply { this.unitWithProrationConfig = unitWithProrationConfig } + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + override fun hashCode(): Int = hashCode - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance + 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 */ } - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, tieredWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + override fun hashCode(): Int = hashCode - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) + 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}" + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + @NoAutoDetect + class NewFloatingUnitWithProrationPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("unit_with_proration_config") + @ExcludeMissing + private val unitWithProrationConfig: JsonField = + JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + fun modelType(): ModelType = modelType.getRequired("model_type") - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + /** The name of the price. */ + fun name(): String = name.getRequired("name") - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + fun unitWithProrationConfig(): UnitWithProrationConfig = + unitWithProrationConfig.getRequired("unit_with_proration_config") /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): NewFloatingUnitWithProrationPrice = - NewFloatingUnitWithProrationPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired("unitWithProrationConfig", unitWithProrationConfig), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } - - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ANNUAL = of("annual") + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - @JvmField val SEMI_ANNUAL = of("semi_annual") - - @JvmField val MONTHLY = of("monthly") + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - @JvmField val QUARTERLY = of("quarterly") + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - @JvmField val ONE_TIME = of("one_time") + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - @JvmField val CUSTOM = of("custom") + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + @JsonProperty("unit_with_proration_config") + @ExcludeMissing + fun _unitWithProrationConfig(): JsonField = + unitWithProrationConfig /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - override fun toString() = value.toString() - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - @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, - } + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * 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, - } + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun value(): Value = - when (this) { - UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION - else -> Value._UNKNOWN - } + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun known(): Known = - when (this) { - UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION - else -> throw OrbInvalidDataException("Unknown ModelType: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - 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() - } - - @NoAutoDetect - class UnitWithProrationConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata @JsonAnyGetter @ExcludeMissing @@ -28903,11 +28827,26 @@ private constructor( private var validated: Boolean = false - fun validate(): UnitWithProrationConfig = apply { + fun validate(): NewFloatingUnitWithProrationPrice = apply { if (validated) { return@apply } + cadence() + currency() + itemId() + modelType() + name() + unitWithProrationConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } validated = true } @@ -28918,142 +28857,285 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [UnitWithProrationConfig]. */ + /** A builder for [NewFloatingUnitWithProrationPrice]. */ class Builder internal constructor() { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var unitWithProrationConfig: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(unitWithProrationConfig: UnitWithProrationConfig) = apply { + 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 = - unitWithProrationConfig.additionalProperties.toMutableMap() + newFloatingUnitWithProrationPrice.additionalProperties.toMutableMap() } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType } - fun build(): UnitWithProrationConfig = - UnitWithProrationConfig(additionalProperties.toImmutable()) - } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } + + fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = + unitWithProrationConfig(JsonField.of(unitWithProrationConfig)) + + fun unitWithProrationConfig( + unitWithProrationConfig: JsonField + ) = apply { this.unitWithProrationConfig = unitWithProrationConfig } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - return /* spotless:off */ other is UnitWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - override fun hashCode(): Int = hashCode + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - override fun toString() = - "UnitWithProrationConfig{additionalProperties=$additionalProperties}" - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - private var validated: Boolean = false + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId } - duration() - durationUnit() - validated = true - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - fun toBuilder() = Builder().from(this) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - companion object { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @JvmStatic fun builder() = Builder() - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -29077,20 +29159,30 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), + fun build(): NewFloatingUnitWithProrationPrice = + NewFloatingUnitWithProrationPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired("unitWithProrationConfig", unitWithProrationConfig), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, additionalProperties.toImmutable(), ) } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -29104,35 +29196,50 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val ANNUAL = of("annual") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val MONTHLY = of("monthly") + + @JvmField val QUARTERLY = of("quarterly") - @JvmField val MONTH = of("month") + @JvmField val ONE_TIME = of("one_time") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmField val CUSTOM = of("custom") + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [Cadence]'s known values. */ enum class Known { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * An instance of [Cadence] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - DAY, - MONTH, + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -29146,8 +29253,12 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM else -> Value._UNKNOWN } @@ -29162,9 +29273,13 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") } fun asString(): String = _value().asStringOrThrow() @@ -29174,7 +29289,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -29182,1055 +29297,1274 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + 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") + } + + fun asString(): String = _value().asStringOrThrow() + + 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() + } + + @NoAutoDetect + class UnitWithProrationConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): UnitWithProrationConfig = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UnitWithProrationConfig]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(unitWithProrationConfig: UnitWithProrationConfig) = apply { + additionalProperties = + unitWithProrationConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): UnitWithProrationConfig = + UnitWithProrationConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is UnitWithProrationConfig && 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() = + "UnitWithProrationConfig{additionalProperties=$additionalProperties}" + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @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)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmField val DAY = of("day") - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + @JvmField val MONTH = of("month") - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun asString(): String = _value().asStringOrThrow() - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - duration() - durationUnit() - validated = true - } + override fun hashCode() = value.hashCode() - fun toBuilder() = Builder().from(this) + override fun toString() = value.toString() + } - companion object { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmStatic fun builder() = Builder() - } + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + override fun hashCode(): Int = hashCode - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() - } + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun duration(): Long = duration.getRequired("duration") /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - 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(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + duration() + durationUnit() + validated = true } - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + fun toBuilder() = Builder().from(this) - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmStatic fun builder() = Builder() + } - companion object { + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - @JvmField val DAY = of("day") + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - @JvmField val MONTH = of("month") + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$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 - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val DAY = of("day") - private var validated: Boolean = false + @JvmField val MONTH = of("month") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - validated = true - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - fun toBuilder() = Builder().from(this) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - @JvmStatic fun builder() = Builder() - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun asString(): String = _value().asStringOrThrow() - private var additionalProperties: MutableMap = mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - 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 */ - } + validated = true + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, unitWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + fun toBuilder() = Builder().from(this) - override fun hashCode(): Int = hashCode + companion object { - 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}" - } + @JvmStatic fun builder() = Builder() + } - @NoAutoDetect - class NewFloatingGroupedAllocationPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("grouped_allocation_config") - @ExcludeMissing - private val groupedAllocationConfig: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + private var additionalProperties: MutableMap = mutableMapOf() - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - fun groupedAllocationConfig(): GroupedAllocationConfig = - groupedAllocationConfig.getRequired("grouped_allocation_config") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - @JsonProperty("grouped_allocation_config") - @ExcludeMissing - fun _groupedAllocationConfig(): JsonField = groupedAllocationConfig - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - private var validated: Boolean = false + override fun hashCode(): Int = hashCode - fun validate(): NewFloatingGroupedAllocationPrice = apply { - if (validated) { - return@apply + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - cadence() - currency() - groupedAllocationConfig().validate() - itemId() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + 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 */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, unitWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - @JvmStatic fun builder() = Builder() - } + override fun hashCode(): Int = hashCode - /** A builder for [NewFloatingGroupedAllocationPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var groupedAllocationConfig: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + 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}" + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @NoAutoDetect + class NewFloatingGroupedAllocationPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("grouped_allocation_config") + @ExcludeMissing + private val groupedAllocationConfig: JsonField = + JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun currency(): String = currency.getRequired("currency") - fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = - groupedAllocationConfig(JsonField.of(groupedAllocationConfig)) - - fun groupedAllocationConfig( - groupedAllocationConfig: JsonField - ) = apply { this.groupedAllocationConfig = groupedAllocationConfig } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun groupedAllocationConfig(): GroupedAllocationConfig = + groupedAllocationConfig.getRequired("grouped_allocation_config") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun itemId(): String = itemId.getRequired("item_id") - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun name(): String = name.getRequired("name") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + @JsonProperty("grouped_allocation_config") + @ExcludeMissing + fun _groupedAllocationConfig(): JsonField = + groupedAllocationConfig - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): NewFloatingGroupedAllocationPrice = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + cadence() + currency() + groupedAllocationConfig().validate() + itemId() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): NewFloatingGroupedAllocationPrice = - NewFloatingGroupedAllocationPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("groupedAllocationConfig", groupedAllocationConfig), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [NewFloatingGroupedAllocationPrice]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var groupedAllocationConfig: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @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() + } + + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - companion object { + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @JvmField val ANNUAL = of("annual") + fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = + groupedAllocationConfig(JsonField.of(groupedAllocationConfig)) - @JvmField val SEMI_ANNUAL = of("semi_annual") + fun groupedAllocationConfig( + groupedAllocationConfig: JsonField + ) = apply { this.groupedAllocationConfig = groupedAllocationConfig } - @JvmField val MONTHLY = of("monthly") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - @JvmField val QUARTERLY = of("quarterly") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - @JvmField val ONE_TIME = of("one_time") + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - @JvmField val CUSTOM = of("custom") + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * The id of the billable metric for the price. Only needed if the price is + * usage-based. */ - _UNKNOWN, - } + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - fun asString(): String = _value().asStringOrThrow() + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - override fun hashCode() = value.hashCode() + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - override fun toString() = value.toString() - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - @NoAutoDetect - class GroupedAllocationConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - private var validated: Boolean = false + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - fun validate(): GroupedAllocationConfig = apply { - if (validated) { - return@apply + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate } - validated = true - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - fun toBuilder() = Builder().from(this) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - companion object { + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - @JvmStatic fun builder() = Builder() - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - /** A builder for [GroupedAllocationConfig]. */ - class Builder internal constructor() { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @JvmSynthetic - internal fun from(groupedAllocationConfig: GroupedAllocationConfig) = apply { - additionalProperties = - groupedAllocationConfig.additionalProperties.toMutableMap() + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -30253,235 +30587,230 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedAllocationConfig = - GroupedAllocationConfig(additionalProperties.toImmutable()) + fun build(): NewFloatingGroupedAllocationPrice = + NewFloatingGroupedAllocationPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("groupedAllocationConfig", groupedAllocationConfig), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - return /* spotless:off */ other is GroupedAllocationConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmField val ANNUAL = of("annual") - override fun toString() = - "GroupedAllocationConfig{additionalProperties=$additionalProperties}" - } + @JvmField val SEMI_ANNUAL = of("semi_annual") - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + @JvmField val MONTHLY = of("monthly") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val QUARTERLY = of("quarterly") - companion object { + @JvmField val ONE_TIME = of("one_time") - @JvmField val GROUPED_ALLOCATION = of("grouped_allocation") + @JvmField val CUSTOM = of("custom") - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_ALLOCATION, - } + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } - /** - * 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. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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") + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, } - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - override fun hashCode() = value.hashCode() + fun asString(): String = _value().asStringOrThrow() - override fun toString() = value.toString() - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + override fun hashCode() = value.hashCode() - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + override fun toString() = value.toString() + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + @NoAutoDetect + class GroupedAllocationConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): GroupedAllocationConfig = apply { + if (validated) { + return@apply + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + validated = true } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { + fun toBuilder() = Builder().from(this) - @JvmStatic fun builder() = Builder() - } + companion object { - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmStatic fun builder() = Builder() + } - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** A builder for [GroupedAllocationConfig]. */ + class Builder internal constructor() { - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + private var additionalProperties: MutableMap = mutableMapOf() - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + @JvmSynthetic + internal fun from(groupedAllocationConfig: GroupedAllocationConfig) = apply { + additionalProperties = + groupedAllocationConfig.additionalProperties.toMutableMap() + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): GroupedAllocationConfig = + GroupedAllocationConfig(additionalProperties.toImmutable()) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is GroupedAllocationConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "GroupedAllocationConfig{additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -30495,35 +30824,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + @JvmField val GROUPED_ALLOCATION = of("grouped_allocation") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + GROUPED_ALLOCATION } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + GROUPED_ALLOCATION, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -30537,8 +30861,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION else -> Value._UNKNOWN } @@ -30553,9 +30876,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -30565,7 +30887,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -30573,1067 +30895,1114 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - private var validated: Boolean = false + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun asString(): String = _value().asStringOrThrow() - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - companion object { + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - @JvmField val DAY = of("day") + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - @JvmField val MONTH = of("month") + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, + fun toBuilder() = Builder().from(this) + + companion object { + + @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) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { + + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - fun asString(): String = _value().asStringOrThrow() + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$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 - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val DAY = of("day") - private var validated: Boolean = false + @JvmField val MONTH = of("month") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - validated = true - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - fun toBuilder() = Builder().from(this) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - @JvmStatic fun builder() = Builder() - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun asString(): String = _value().asStringOrThrow() - private var additionalProperties: MutableMap = mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - 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 */ - } + validated = true + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedAllocationConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + fun toBuilder() = Builder().from(this) - override fun hashCode(): Int = hashCode + companion object { - 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}" - } + @JvmStatic fun builder() = Builder() + } - @NoAutoDetect - class NewFloatingGroupedWithProratedMinimumPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("grouped_with_prorated_minimum_config") - @ExcludeMissing - private val groupedWithProratedMinimumConfig: JsonField = - JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + private var additionalProperties: MutableMap = mutableMapOf() - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = - groupedWithProratedMinimumConfig.getRequired("grouped_with_prorated_minimum_config") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - @JsonProperty("grouped_with_prorated_minimum_config") - @ExcludeMissing - fun _groupedWithProratedMinimumConfig(): JsonField = - groupedWithProratedMinimumConfig - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - private var validated: Boolean = false + override fun hashCode(): Int = hashCode - fun validate(): NewFloatingGroupedWithProratedMinimumPrice = apply { - if (validated) { - return@apply + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - cadence() - currency() - groupedWithProratedMinimumConfig().validate() - itemId() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + 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 */ + } - fun toBuilder() = Builder().from(this) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedAllocationConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - companion object { + override fun hashCode(): Int = hashCode - @JvmStatic fun builder() = Builder() + 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}" } - /** A builder for [NewFloatingGroupedWithProratedMinimumPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var groupedWithProratedMinimumConfig: - JsonField? = - null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } - - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @NoAutoDetect + class NewFloatingGroupedWithProratedMinimumPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("grouped_with_prorated_minimum_config") + @ExcludeMissing + private val groupedWithProratedMinimumConfig: + JsonField = + JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + fun currency(): String = currency.getRequired("currency") - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig - ) = groupedWithProratedMinimumConfig(JsonField.of(groupedWithProratedMinimumConfig)) - - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: JsonField - ) = apply { this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = + groupedWithProratedMinimumConfig.getRequired("grouped_with_prorated_minimum_config") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun itemId(): String = itemId.getRequired("item_id") - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun name(): String = name.getRequired("name") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + @JsonProperty("grouped_with_prorated_minimum_config") + @ExcludeMissing + fun _groupedWithProratedMinimumConfig(): JsonField = + groupedWithProratedMinimumConfig - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): NewFloatingGroupedWithProratedMinimumPrice = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + cadence() + currency() + groupedWithProratedMinimumConfig().validate() + itemId() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): NewFloatingGroupedWithProratedMinimumPrice = - NewFloatingGroupedWithProratedMinimumPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired( - "groupedWithProratedMinimumConfig", - groupedWithProratedMinimumConfig - ), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [NewFloatingGroupedWithProratedMinimumPrice]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var groupedWithProratedMinimumConfig: + JsonField? = + null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @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() + } - companion object { + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - @JvmField val ANNUAL = of("annual") + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - @JvmField val SEMI_ANNUAL = of("semi_annual") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - @JvmField val MONTHLY = of("monthly") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @JvmField val QUARTERLY = of("quarterly") + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = groupedWithProratedMinimumConfig(JsonField.of(groupedWithProratedMinimumConfig)) - @JvmField val ONE_TIME = of("one_time") + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: JsonField + ) = apply { + this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig + } - @JvmField val CUSTOM = of("custom") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } + + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * The id of the billable metric for the price. Only needed if the price is + * usage-based. */ - _UNKNOWN, - } + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - fun asString(): String = _value().asStringOrThrow() + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - override fun hashCode() = value.hashCode() + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - override fun toString() = value.toString() - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - @NoAutoDetect - class GroupedWithProratedMinimumConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - private var validated: Boolean = false + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - fun validate(): GroupedWithProratedMinimumConfig = apply { - if (validated) { - return@apply + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate } - validated = true - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - fun toBuilder() = Builder().from(this) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - companion object { + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - @JvmStatic fun builder() = Builder() - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - /** A builder for [GroupedWithProratedMinimumConfig]. */ - class Builder internal constructor() { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @JvmSynthetic - internal fun from( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig - ) = apply { - additionalProperties = - groupedWithProratedMinimumConfig.additionalProperties.toMutableMap() + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -31656,235 +32025,235 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedWithProratedMinimumConfig = - GroupedWithProratedMinimumConfig(additionalProperties.toImmutable()) + fun build(): NewFloatingGroupedWithProratedMinimumPrice = + NewFloatingGroupedWithProratedMinimumPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired( + "groupedWithProratedMinimumConfig", + groupedWithProratedMinimumConfig, + ), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - return /* spotless:off */ other is GroupedWithProratedMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmField val ANNUAL = of("annual") - override fun toString() = - "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" - } + @JvmField val SEMI_ANNUAL = of("semi_annual") - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + @JvmField val MONTHLY = of("monthly") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val QUARTERLY = of("quarterly") - companion object { + @JvmField val ONE_TIME = of("one_time") - @JvmField val GROUPED_WITH_PRORATED_MINIMUM = of("grouped_with_prorated_minimum") + @JvmField val CUSTOM = of("custom") - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_PRORATED_MINIMUM, - } + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } + + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - /** - * 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. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - _UNKNOWN, - } + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") - } + fun asString(): String = _value().asStringOrThrow() - fun asString(): String = _value().asStringOrThrow() + 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 Cadence && value == other.value /* spotless:on */ } - 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. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + override fun hashCode() = value.hashCode() - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + override fun toString() = value.toString() + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + @NoAutoDetect + class GroupedWithProratedMinimumConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): GroupedWithProratedMinimumConfig = apply { + if (validated) { + return@apply + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + validated = true } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) + fun toBuilder() = Builder().from(this) - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmStatic fun builder() = Builder() + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** A builder for [GroupedWithProratedMinimumConfig]. */ + class Builder internal constructor() { - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + @JvmSynthetic + internal fun from( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = apply { + additionalProperties = + groupedWithProratedMinimumConfig.additionalProperties.toMutableMap() + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun build(): GroupedWithProratedMinimumConfig = + GroupedWithProratedMinimumConfig(additionalProperties.toImmutable()) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is GroupedWithProratedMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -31898,35 +32267,31 @@ private constructor( companion object { - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + @JvmField + val GROUPED_WITH_PRORATED_MINIMUM = of("grouped_with_prorated_minimum") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + GROUPED_WITH_PRORATED_MINIMUM } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + GROUPED_WITH_PRORATED_MINIMUM, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -31940,8 +32305,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM else -> Value._UNKNOWN } @@ -31956,9 +32320,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -31968,7 +32331,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -31976,1065 +32339,1111 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + 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)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + fun asString(): String = _value().asStringOrThrow() - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - private var validated: Boolean = false + override fun hashCode() = value.hashCode() - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + override fun toString() = value.toString() } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmStatic fun builder() = Builder() - } + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + override fun hashCode(): Int = hashCode - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() - } + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun duration(): Long = duration.getRequired("duration") /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - 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(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + duration() + durationUnit() + validated = true } - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + fun toBuilder() = Builder().from(this) - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmStatic fun builder() = Builder() + } - companion object { + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - @JvmField val DAY = of("day") + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - @JvmField val MONTH = of("month") + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$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 - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val DAY = of("day") - private var validated: Boolean = false + @JvmField val MONTH = of("month") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - validated = true - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - fun toBuilder() = Builder().from(this) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - @JvmStatic fun builder() = Builder() - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun asString(): String = _value().asStringOrThrow() - private var additionalProperties: MutableMap = mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - 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 */ - } + validated = true + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedWithProratedMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + fun toBuilder() = Builder().from(this) - override fun hashCode(): Int = hashCode + companion object { - 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}" - } + @JvmStatic fun builder() = Builder() + } - @NoAutoDetect - class NewFloatingGroupedWithMeteredMinimumPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("grouped_with_metered_minimum_config") - @ExcludeMissing - private val groupedWithMeteredMinimumConfig: JsonField = - JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + private var additionalProperties: MutableMap = mutableMapOf() - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = - groupedWithMeteredMinimumConfig.getRequired("grouped_with_metered_minimum_config") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - @JsonProperty("grouped_with_metered_minimum_config") - @ExcludeMissing - fun _groupedWithMeteredMinimumConfig(): JsonField = - groupedWithMeteredMinimumConfig - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - private var validated: Boolean = false + override fun hashCode(): Int = hashCode - fun validate(): NewFloatingGroupedWithMeteredMinimumPrice = apply { - if (validated) { - return@apply + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - cadence() - currency() - groupedWithMeteredMinimumConfig().validate() - itemId() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + 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 */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedWithProratedMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - @JvmStatic fun builder() = Builder() - } + override fun hashCode(): Int = hashCode - /** A builder for [NewFloatingGroupedWithMeteredMinimumPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var groupedWithMeteredMinimumConfig: - JsonField? = - null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + 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}" + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @NoAutoDetect + class NewFloatingGroupedWithMeteredMinimumPrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("grouped_with_metered_minimum_config") + @ExcludeMissing + private val groupedWithMeteredMinimumConfig: + JsonField = + JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - fun groupedWithMeteredMinimumConfig( - groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig - ) = groupedWithMeteredMinimumConfig(JsonField.of(groupedWithMeteredMinimumConfig)) + fun currency(): String = currency.getRequired("currency") - fun groupedWithMeteredMinimumConfig( - groupedWithMeteredMinimumConfig: JsonField - ) = apply { this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } + fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = + groupedWithMeteredMinimumConfig.getRequired("grouped_with_metered_minimum_config") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun itemId(): String = itemId.getRequired("item_id") - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun name(): String = name.getRequired("name") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + @JsonProperty("grouped_with_metered_minimum_config") + @ExcludeMissing + fun _groupedWithMeteredMinimumConfig(): JsonField = + groupedWithMeteredMinimumConfig - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): NewFloatingGroupedWithMeteredMinimumPrice = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + cadence() + currency() + groupedWithMeteredMinimumConfig().validate() + itemId() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): NewFloatingGroupedWithMeteredMinimumPrice = - NewFloatingGroupedWithMeteredMinimumPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired( - "groupedWithMeteredMinimumConfig", - groupedWithMeteredMinimumConfig - ), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [NewFloatingGroupedWithMeteredMinimumPrice]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var groupedWithMeteredMinimumConfig: + JsonField? = + null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @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() + } - companion object { + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + fun groupedWithMeteredMinimumConfig( + groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig + ) = groupedWithMeteredMinimumConfig(JsonField.of(groupedWithMeteredMinimumConfig)) + + fun groupedWithMeteredMinimumConfig( + groupedWithMeteredMinimumConfig: JsonField + ) = apply { this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - @JvmField val ANNUAL = of("annual") + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - @JvmField val SEMI_ANNUAL = of("semi_annual") + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - @JvmField val MONTHLY = of("monthly") + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - @JvmField val QUARTERLY = of("quarterly") + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - @JvmField val ONE_TIME = of("one_time") + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - @JvmField val CUSTOM = of("custom") + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * For custom cadence: specifies the duration of the billing period in days or + * months. */ - _UNKNOWN, - } + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - fun asString(): String = _value().asStringOrThrow() + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - override fun hashCode() = value.hashCode() + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - override fun toString() = value.toString() - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - @NoAutoDetect - class GroupedWithMeteredMinimumConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - private var validated: Boolean = false + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - fun validate(): GroupedWithMeteredMinimumConfig = apply { - if (validated) { - return@apply + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity } - validated = true - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - fun toBuilder() = Builder().from(this) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - companion object { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - @JvmStatic fun builder() = Builder() - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** A builder for [GroupedWithMeteredMinimumConfig]. */ - class Builder internal constructor() { + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - @JvmSynthetic - internal fun from( - groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig - ) = apply { - additionalProperties = - groupedWithMeteredMinimumConfig.additionalProperties.toMutableMap() - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -33058,235 +33467,235 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedWithMeteredMinimumConfig = - GroupedWithMeteredMinimumConfig(additionalProperties.toImmutable()) + fun build(): NewFloatingGroupedWithMeteredMinimumPrice = + NewFloatingGroupedWithMeteredMinimumPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired( + "groupedWithMeteredMinimumConfig", + groupedWithMeteredMinimumConfig, + ), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - return /* spotless:off */ other is GroupedWithMeteredMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmField val ANNUAL = of("annual") - override fun toString() = - "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" - } + @JvmField val SEMI_ANNUAL = of("semi_annual") - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + @JvmField val MONTHLY = of("monthly") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val QUARTERLY = of("quarterly") - companion object { + @JvmField val ONE_TIME = of("one_time") - @JvmField val GROUPED_WITH_METERED_MINIMUM = of("grouped_with_metered_minimum") + @JvmField val CUSTOM = of("custom") - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_WITH_METERED_MINIMUM, - } + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } - /** - * 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. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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") + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, } - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - override fun hashCode() = value.hashCode() + fun asString(): String = _value().asStringOrThrow() - override fun toString() = value.toString() - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + override fun hashCode() = value.hashCode() - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + override fun toString() = value.toString() + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + @NoAutoDetect + class GroupedWithMeteredMinimumConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): GroupedWithMeteredMinimumConfig = apply { + if (validated) { + return@apply + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + validated = true } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) + fun toBuilder() = Builder().from(this) - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmStatic fun builder() = Builder() + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** A builder for [GroupedWithMeteredMinimumConfig]. */ + class Builder internal constructor() { - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + @JvmSynthetic + internal fun from( + groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig + ) = apply { + additionalProperties = + groupedWithMeteredMinimumConfig.additionalProperties.toMutableMap() + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun build(): GroupedWithMeteredMinimumConfig = + GroupedWithMeteredMinimumConfig(additionalProperties.toImmutable()) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is GroupedWithMeteredMinimumConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -33300,35 +33709,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val GROUPED_WITH_METERED_MINIMUM = of("grouped_with_metered_minimum") - @JvmField val MONTH = of("month") - - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + GROUPED_WITH_METERED_MINIMUM } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + GROUPED_WITH_METERED_MINIMUM, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -33342,8 +33746,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM else -> Value._UNKNOWN } @@ -33358,9 +33761,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -33370,7 +33772,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -33378,1059 +33780,1105 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - private var validated: Boolean = false + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun asString(): String = _value().asStringOrThrow() - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - companion object { + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - @JvmField val DAY = of("day") + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - @JvmField val MONTH = of("month") + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, + fun toBuilder() = Builder().from(this) + + companion object { + + @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) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - fun asString(): String = _value().asStringOrThrow() + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$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 - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val DAY = of("day") - private var validated: Boolean = false + @JvmField val MONTH = of("month") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - validated = true - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - fun toBuilder() = Builder().from(this) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - @JvmStatic fun builder() = Builder() - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun asString(): String = _value().asStringOrThrow() - private var additionalProperties: MutableMap = mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - 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 */ - } + validated = true + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedWithMeteredMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + fun toBuilder() = Builder().from(this) - override fun hashCode(): Int = hashCode + companion object { - 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}" - } + @JvmStatic fun builder() = Builder() + } - @NoAutoDetect - class NewFloatingMatrixWithDisplayNamePrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("matrix_with_display_name_config") - @ExcludeMissing - private val matrixWithDisplayNameConfig: JsonField = - JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + private var additionalProperties: MutableMap = mutableMapOf() - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = - matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("matrix_with_display_name_config") - @ExcludeMissing - fun _matrixWithDisplayNameConfig(): JsonField = - matrixWithDisplayNameConfig - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - private var validated: Boolean = false + override fun hashCode(): Int = hashCode - fun validate(): NewFloatingMatrixWithDisplayNamePrice = apply { - if (validated) { - return@apply + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - cadence() - currency() - itemId() - matrixWithDisplayNameConfig().validate() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + 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 */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedWithMeteredMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - @JvmStatic fun builder() = Builder() - } + override fun hashCode(): Int = hashCode - /** A builder for [NewFloatingMatrixWithDisplayNamePrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var matrixWithDisplayNameConfig: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + 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}" + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @NoAutoDetect + class NewFloatingMatrixWithDisplayNamePrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("matrix_with_display_name_config") + @ExcludeMissing + private val matrixWithDisplayNameConfig: JsonField = + JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun currency(): String = currency.getRequired("currency") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + fun itemId(): String = itemId.getRequired("item_id") - fun matrixWithDisplayNameConfig( - matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig - ) = matrixWithDisplayNameConfig(JsonField.of(matrixWithDisplayNameConfig)) + fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = + matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") - fun matrixWithDisplayNameConfig( - matrixWithDisplayNameConfig: JsonField - ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } - - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + fun name(): String = name.getRequired("name") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + @JsonProperty("matrix_with_display_name_config") + @ExcludeMissing + fun _matrixWithDisplayNameConfig(): JsonField = + matrixWithDisplayNameConfig - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): NewFloatingMatrixWithDisplayNamePrice = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + cadence() + currency() + itemId() + matrixWithDisplayNameConfig().validate() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): NewFloatingMatrixWithDisplayNamePrice = - NewFloatingMatrixWithDisplayNamePrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("matrixWithDisplayNameConfig", matrixWithDisplayNameConfig), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [NewFloatingMatrixWithDisplayNamePrice]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var matrixWithDisplayNameConfig: JsonField? = + null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @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() + } - companion object { + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - @JvmField val ANNUAL = of("annual") + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - @JvmField val SEMI_ANNUAL = of("semi_annual") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - @JvmField val MONTHLY = of("monthly") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @JvmField val QUARTERLY = of("quarterly") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - @JvmField val ONE_TIME = of("one_time") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - @JvmField val CUSTOM = of("custom") + fun matrixWithDisplayNameConfig( + matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig + ) = matrixWithDisplayNameConfig(JsonField.of(matrixWithDisplayNameConfig)) - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + fun matrixWithDisplayNameConfig( + matrixWithDisplayNameConfig: JsonField + ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } + + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * The id of the billable metric for the price. Only needed if the price is + * usage-based. */ - _UNKNOWN, - } + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance } - fun asString(): String = _value().asStringOrThrow() + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - override fun hashCode() = value.hashCode() + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - override fun toString() = value.toString() - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - @NoAutoDetect - class MatrixWithDisplayNameConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - private var validated: Boolean = false + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - fun validate(): MatrixWithDisplayNameConfig = apply { - if (validated) { - return@apply + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity } - validated = true - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - fun toBuilder() = Builder().from(this) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - companion object { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - @JvmStatic fun builder() = Builder() - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** A builder for [MatrixWithDisplayNameConfig]. */ - class Builder internal constructor() { + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - @JvmSynthetic - internal fun from(matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig) = - apply { - additionalProperties = - matrixWithDisplayNameConfig.additionalProperties.toMutableMap() - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -34454,235 +34902,231 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): MatrixWithDisplayNameConfig = - MatrixWithDisplayNameConfig(additionalProperties.toImmutable()) + fun build(): NewFloatingMatrixWithDisplayNamePrice = + NewFloatingMatrixWithDisplayNamePrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("matrixWithDisplayNameConfig", matrixWithDisplayNameConfig), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - return /* spotless:off */ other is MatrixWithDisplayNameConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmField val ANNUAL = of("annual") - override fun toString() = - "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" - } + @JvmField val SEMI_ANNUAL = of("semi_annual") - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + @JvmField val MONTHLY = of("monthly") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val QUARTERLY = of("quarterly") - companion object { + @JvmField val ONE_TIME = of("one_time") - @JvmField val MATRIX_WITH_DISPLAY_NAME = of("matrix_with_display_name") + @JvmField val CUSTOM = of("custom") - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - MATRIX_WITH_DISPLAY_NAME, - } + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } - /** - * 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. + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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") + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, } - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - override fun hashCode() = value.hashCode() + fun asString(): String = _value().asStringOrThrow() - override fun toString() = value.toString() - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + override fun hashCode() = value.hashCode() - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + override fun toString() = value.toString() + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + @NoAutoDetect + class MatrixWithDisplayNameConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): MatrixWithDisplayNameConfig = apply { + if (validated) { + return@apply + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + validated = true } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) + fun toBuilder() = Builder().from(this) - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmStatic fun builder() = Builder() + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** A builder for [MatrixWithDisplayNameConfig]. */ + class Builder internal constructor() { - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + @JvmSynthetic + internal fun from(matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig) = + apply { + additionalProperties = + matrixWithDisplayNameConfig.additionalProperties.toMutableMap() + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun build(): MatrixWithDisplayNameConfig = + MatrixWithDisplayNameConfig(additionalProperties.toImmutable()) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is MatrixWithDisplayNameConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -34696,35 +35140,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val MATRIX_WITH_DISPLAY_NAME = of("matrix_with_display_name") - @JvmField val MONTH = of("month") - - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + MATRIX_WITH_DISPLAY_NAME } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + MATRIX_WITH_DISPLAY_NAME, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -34738,8 +35177,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME else -> Value._UNKNOWN } @@ -34754,9 +35192,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -34766,7 +35203,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -34774,935 +35211,1103 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - private var validated: Boolean = false + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && 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 BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun duration(): Long = duration.getRequired("duration") /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - 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(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + duration() + durationUnit() + validated = true } - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + fun toBuilder() = Builder().from(this) - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + companion object { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmStatic fun builder() = Builder() + } - companion object { + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - @JvmField val DAY = of("day") + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - @JvmField val MONTH = of("month") + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$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 - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val DAY = of("day") - private var validated: Boolean = false + @JvmField val MONTH = of("month") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - validated = true - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - fun toBuilder() = Builder().from(this) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - @JvmStatic fun builder() = Builder() - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun asString(): String = _value().asStringOrThrow() - private var additionalProperties: MutableMap = mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + private var validated: Boolean = false - override fun hashCode(): Int = hashCode + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + validated = true + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun toBuilder() = Builder().from(this) - 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 */ - } + companion object { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, matrixWithDisplayNameConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + @JvmStatic fun builder() = Builder() + } - override fun hashCode(): Int = hashCode + /** A builder for [Metadata]. */ + class Builder internal constructor() { - 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}" - } + private var additionalProperties: MutableMap = mutableMapOf() - @NoAutoDetect - class NewFloatingBulkWithProrationPrice - @JsonCreator - private constructor( - @JsonProperty("bulk_with_proration_config") - @ExcludeMissing - private val bulkWithProrationConfig: JsonField = JsonMissing.of(), - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - fun bulkWithProrationConfig(): BulkWithProrationConfig = - bulkWithProrationConfig.getRequired("bulk_with_proration_config") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + override fun hashCode(): Int = hashCode - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - @JsonProperty("bulk_with_proration_config") - @ExcludeMissing - fun _bulkWithProrationConfig(): JsonField = bulkWithProrationConfig - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): NewFloatingBulkWithProrationPrice = apply { - if (validated) { - return@apply + 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 */ } - bulkWithProrationConfig().validate() - cadence() - currency() - itemId() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, matrixWithDisplayNameConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - companion object { + override fun hashCode(): Int = hashCode - @JvmStatic fun builder() = Builder() + 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}" } - /** A builder for [NewFloatingBulkWithProrationPrice]. */ - class Builder internal constructor() { - - private var bulkWithProrationConfig: JsonField? = null - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } - - fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = - bulkWithProrationConfig(JsonField.of(bulkWithProrationConfig)) - - fun bulkWithProrationConfig( - bulkWithProrationConfig: JsonField - ) = apply { this.bulkWithProrationConfig = bulkWithProrationConfig } + @NoAutoDetect + class NewFloatingBulkWithProrationPrice + @JsonCreator + private constructor( + @JsonProperty("bulk_with_proration_config") + @ExcludeMissing + private val bulkWithProrationConfig: JsonField = + JsonMissing.of(), + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun bulkWithProrationConfig(): BulkWithProrationConfig = + bulkWithProrationConfig.getRequired("bulk_with_proration_config") /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun currency(): String = currency.getRequired("currency") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun itemId(): String = itemId.getRequired("item_id") - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun name(): String = name.getRequired("name") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * For custom cadence: specifies the duration of the billing period in days or months. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + @JsonProperty("bulk_with_proration_config") + @ExcludeMissing + fun _bulkWithProrationConfig(): JsonField = + bulkWithProrationConfig - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** * Within each billing cycle, specifies the cadence at which invoices are produced. If * unspecified, a single invoice is produced per billing cycle. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + private var validated: Boolean = false - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun validate(): NewFloatingBulkWithProrationPrice = apply { + if (validated) { + return@apply + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + bulkWithProrationConfig().validate() + cadence() + currency() + itemId() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun toBuilder() = Builder().from(this) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): NewFloatingBulkWithProrationPrice = - NewFloatingBulkWithProrationPrice( - checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [NewFloatingBulkWithProrationPrice]. */ + class Builder internal constructor() { - @NoAutoDetect - class BulkWithProrationConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var bulkWithProrationConfig: JsonField? = null + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @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() + } + + fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = + bulkWithProrationConfig(JsonField.of(bulkWithProrationConfig)) + + fun bulkWithProrationConfig( + bulkWithProrationConfig: JsonField + ) = apply { this.bulkWithProrationConfig = bulkWithProrationConfig } + + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } + + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - private var validated: Boolean = false + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - fun validate(): BulkWithProrationConfig = apply { - if (validated) { - return@apply + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity } - validated = true - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - fun toBuilder() = Builder().from(this) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - companion object { + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - @JvmStatic fun builder() = Builder() - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** A builder for [BulkWithProrationConfig]. */ - class Builder internal constructor() { + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - @JvmSynthetic - internal fun from(bulkWithProrationConfig: BulkWithProrationConfig) = apply { - additionalProperties = - bulkWithProrationConfig.additionalProperties.toMutableMap() - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -35726,354 +36331,230 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): BulkWithProrationConfig = - BulkWithProrationConfig(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is BulkWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ + fun build(): NewFloatingBulkWithProrationPrice = + NewFloatingBulkWithProrationPrice( + checkRequired("bulkWithProrationConfig", bulkWithProrationConfig), + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + @NoAutoDetect + class BulkWithProrationConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = - "BulkWithProrationConfig{additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + fun validate(): BulkWithProrationConfig = apply { + if (validated) { + return@apply + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + validated = true + } - companion object { + fun toBuilder() = Builder().from(this) - @JvmField val ANNUAL = of("annual") + companion object { - @JvmField val SEMI_ANNUAL = of("semi_annual") + @JvmStatic fun builder() = Builder() + } - @JvmField val MONTHLY = of("monthly") + /** A builder for [BulkWithProrationConfig]. */ + class Builder internal constructor() { - @JvmField val QUARTERLY = of("quarterly") + private var additionalProperties: MutableMap = mutableMapOf() - @JvmField val ONE_TIME = of("one_time") + @JvmSynthetic + internal fun from(bulkWithProrationConfig: BulkWithProrationConfig) = apply { + additionalProperties = + bulkWithProrationConfig.additionalProperties.toMutableMap() + } - @JvmField val CUSTOM = of("custom") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") + fun build(): BulkWithProrationConfig = + BulkWithProrationConfig(additionalProperties.toImmutable()) } - fun asString(): String = _value().asStringOrThrow() + 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 BulkWithProrationConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - 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 { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - @JvmField val BULK_WITH_PRORATION = of("bulk_with_proration") + override fun hashCode(): Int = hashCode - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + override fun toString() = + "BulkWithProrationConfig{additionalProperties=$additionalProperties}" } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - BULK_WITH_PRORATION, - } + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** - * 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. + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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") - } - - fun asString(): String = _value().asStringOrThrow() - - 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() - } + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmField val ANNUAL = of("annual") - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + @JvmField val SEMI_ANNUAL = of("semi_annual") - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + @JvmField val MONTHLY = of("monthly") - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + @JvmField val QUARTERLY = of("quarterly") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val ONE_TIME = of("one_time") - private var validated: Boolean = false + @JvmField val CUSTOM = of("custom") - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @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() + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) - - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) - - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode() = value.hashCode() - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun toString() = value.toString() } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -36087,35 +36568,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") + @JvmField val BULK_WITH_PRORATION = of("bulk_with_proration") - @JvmField val MONTH = of("month") - - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + BULK_WITH_PRORATION } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + BULK_WITH_PRORATION, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -36129,8 +36605,7 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION else -> Value._UNKNOWN } @@ -36145,9 +36620,8 @@ private constructor( */ fun known(): Known = when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION + else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() @@ -36157,7 +36631,7 @@ private constructor( return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() @@ -36165,1058 +36639,1106 @@ private constructor( override fun toString() = value.toString() } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - private var validated: Boolean = false + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun asString(): String = _value().asStringOrThrow() - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - companion object { + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - @JvmField val DAY = of("day") + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - @JvmField val MONTH = of("month") + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, + fun toBuilder() = Builder().from(this) + + companion object { + + @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) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit } - fun asString(): String = _value().asStringOrThrow() + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - override fun hashCode() = value.hashCode() + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - override fun toString() = value.toString() - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$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 - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + companion object { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + @JvmField val DAY = of("day") - private var validated: Boolean = false + @JvmField val MONTH = of("month") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - validated = true - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - fun toBuilder() = Builder().from(this) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - @JvmStatic fun builder() = Builder() - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun asString(): String = _value().asStringOrThrow() - private var additionalProperties: MutableMap = mutableMapOf() + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + override fun hashCode(): Int = hashCode - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - override fun hashCode(): Int = hashCode + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - 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 */ - } + validated = true + } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(bulkWithProrationConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + fun toBuilder() = Builder().from(this) - override fun hashCode(): Int = hashCode + companion object { - 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}" - } + @JvmStatic fun builder() = Builder() + } - @NoAutoDetect - class NewFloatingGroupedTieredPackagePrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("grouped_tiered_package_config") - @ExcludeMissing - private val groupedTieredPackageConfig: JsonField = - JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** A builder for [Metadata]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + private var additionalProperties: MutableMap = mutableMapOf() - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } - fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = - groupedTieredPackageConfig.getRequired("grouped_tiered_package_config") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The name of the price. */ - fun name(): String = name.getRequired("name") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - @JsonProperty("grouped_tiered_package_config") - @ExcludeMissing - fun _groupedTieredPackageConfig(): JsonField = - groupedTieredPackageConfig - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - private var validated: Boolean = false + override fun hashCode(): Int = hashCode - fun validate(): NewFloatingGroupedTieredPackagePrice = apply { - if (validated) { - return@apply + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - cadence() - currency() - groupedTieredPackageConfig().validate() - itemId() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + 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 */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(bulkWithProrationConfig, cadence, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + /* spotless:on */ - @JvmStatic fun builder() = Builder() - } + override fun hashCode(): Int = hashCode - /** A builder for [NewFloatingGroupedTieredPackagePrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var groupedTieredPackageConfig: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + 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}" + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + @NoAutoDetect + class NewFloatingGroupedTieredPackagePrice + @JsonCreator + private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("grouped_tiered_package_config") + @ExcludeMissing + private val groupedTieredPackageConfig: JsonField = + JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + fun cadence(): Cadence = cadence.getRequired("cadence") /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun currency(): String = currency.getRequired("currency") - fun groupedTieredPackageConfig(groupedTieredPackageConfig: GroupedTieredPackageConfig) = - groupedTieredPackageConfig(JsonField.of(groupedTieredPackageConfig)) - - fun groupedTieredPackageConfig( - groupedTieredPackageConfig: JsonField - ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } - - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = + groupedTieredPackageConfig.getRequired("grouped_tiered_package_config") /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun itemId(): String = itemId.getRequired("item_id") - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(): ModelType = modelType.getRequired("model_type") /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) - - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + fun name(): String = name.getRequired("name") /** * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) /** * If the Price represents a fixed cost, the price will be billed in-advance if this is * true, and in-arrears if this is false. */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) /** * For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) - - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) /** * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) /** - * If the Price represents a fixed cost, this represents the quantity of units applied. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + @JsonProperty("grouped_tiered_package_config") + @ExcludeMissing + fun _groupedTieredPackageConfig(): JsonField = + groupedTieredPackageConfig + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId + + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType + + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. + * For custom cadence: specifies the duration of the billing period in days or months. */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate + + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by * setting `metadata` to `null`. */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + private var validated: Boolean = false + + fun validate(): NewFloatingGroupedTieredPackagePrice = apply { + if (validated) { + return@apply + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) + cadence() + currency() + groupedTieredPackageConfig().validate() + itemId() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + fun toBuilder() = Builder().from(this) + + companion object { - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + @JvmStatic fun builder() = Builder() } - fun build(): NewFloatingGroupedTieredPackagePrice = - NewFloatingGroupedTieredPackagePrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** A builder for [NewFloatingGroupedTieredPackagePrice]. */ + class Builder internal constructor() { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var groupedTieredPackageConfig: JsonField? = + null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @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() + } - companion object { + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - @JvmField val ANNUAL = of("annual") + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - @JvmField val SEMI_ANNUAL = of("semi_annual") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - @JvmField val MONTHLY = of("monthly") + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @JvmField val QUARTERLY = of("quarterly") + fun groupedTieredPackageConfig( + groupedTieredPackageConfig: GroupedTieredPackageConfig + ) = groupedTieredPackageConfig(JsonField.of(groupedTieredPackageConfig)) - @JvmField val ONE_TIME = of("one_time") + fun groupedTieredPackageConfig( + groupedTieredPackageConfig: JsonField + ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } - @JvmField val CUSTOM = of("custom") + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } + + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * The id of the billable metric for the price. Only needed if the price is + * usage-based. */ - _UNKNOWN, - } + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId } - fun asString(): String = _value().asStringOrThrow() + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - override fun hashCode() = value.hashCode() + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - override fun toString() = value.toString() - } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - @NoAutoDetect - class GroupedTieredPackageConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - private var validated: Boolean = false + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - fun validate(): GroupedTieredPackageConfig = apply { - if (validated) { - return@apply + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate } - validated = true - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - fun toBuilder() = Builder().from(this) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - companion object { + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - @JvmStatic fun builder() = Builder() - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - /** A builder for [GroupedTieredPackageConfig]. */ - class Builder internal constructor() { + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - @JvmSynthetic - internal fun from(groupedTieredPackageConfig: GroupedTieredPackageConfig) = apply { - additionalProperties = - groupedTieredPackageConfig.additionalProperties.toMutableMap() + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -37239,235 +37761,231 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): GroupedTieredPackageConfig = - GroupedTieredPackageConfig(additionalProperties.toImmutable()) + fun build(): NewFloatingGroupedTieredPackagePrice = + NewFloatingGroupedTieredPackagePrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("groupedTieredPackageConfig", groupedTieredPackageConfig), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - return /* spotless:off */ other is GroupedTieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmField val ANNUAL = of("annual") - override fun toString() = - "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" - } + @JvmField val SEMI_ANNUAL = of("semi_annual") - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + @JvmField val MONTHLY = of("monthly") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val QUARTERLY = of("quarterly") - companion object { + @JvmField val ONE_TIME = of("one_time") - @JvmField val GROUPED_TIERED_PACKAGE = of("grouped_tiered_package") + @JvmField val CUSTOM = of("custom") - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - GROUPED_TIERED_PACKAGE, - } + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } + + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - /** - * 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. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 - } + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") - } + fun asString(): String = _value().asStringOrThrow() - fun asString(): String = _value().asStringOrThrow() + 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 Cadence && value == other.value /* spotless:on */ } - 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. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + override fun hashCode() = value.hashCode() - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + override fun toString() = value.toString() + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + @NoAutoDetect + class GroupedTieredPackageConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): GroupedTieredPackageConfig = apply { + if (validated) { + return@apply + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + validated = true } - duration() - durationUnit() - validated = true - } - - fun toBuilder() = Builder().from(this) + fun toBuilder() = Builder().from(this) - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmStatic fun builder() = Builder() + } - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + /** A builder for [GroupedTieredPackageConfig]. */ + class Builder internal constructor() { - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + @JvmSynthetic + internal fun from(groupedTieredPackageConfig: GroupedTieredPackageConfig) = + apply { + additionalProperties = + groupedTieredPackageConfig.additionalProperties.toMutableMap() + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + fun build(): GroupedTieredPackageConfig = + GroupedTieredPackageConfig(additionalProperties.toImmutable()) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is GroupedTieredPackageConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -37481,35 +37999,30 @@ private constructor( companion object { - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + @JvmField val GROUPED_TIERED_PACKAGE = of("grouped_tiered_package") - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** An enum containing [DurationUnit]'s known values. */ + /** An enum containing [ModelType]'s known values. */ enum class Known { - DAY, - MONTH, + GROUPED_TIERED_PACKAGE } /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [ModelType]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: + * 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 { - DAY, - MONTH, + GROUPED_TIERED_PACKAGE, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * An enum member indicating that [ModelType] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -37523,271 +38036,589 @@ private constructor( */ fun value(): Value = when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH + 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) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to 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") + } + + fun asString(): String = _value().asStringOrThrow() + + 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. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @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)) + + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) + } + + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DAY = of("day") + + @JvmField val MONTH = of("month") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } + + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + 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 DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - private var validated: Boolean = false + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun asString(): String = _value().asStringOrThrow() - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - companion object { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmField val DAY = of("day") + private var validated: Boolean = false - @JvmField val MONTH = of("month") + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + validated = true } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + fun toBuilder() = Builder().from(this) - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, + companion object { + + @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) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @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) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + 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 asString(): String = _value().asStringOrThrow() + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Metadata && 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() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -37795,1415 +38626,1451 @@ private constructor( return true } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewFloatingGroupedTieredPackagePrice && cadence == other.cadence && currency == other.currency && groupedTieredPackageConfig == other.groupedTieredPackageConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedTieredPackageConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + "NewFloatingGroupedTieredPackagePrice{cadence=$cadence, currency=$currency, groupedTieredPackageConfig=$groupedTieredPackageConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ @NoAutoDetect - class Metadata + class NewFloatingScalableMatrixWithUnitPricingPrice @JsonCreator private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("scalable_matrix_with_unit_pricing_config") + @ExcludeMissing + private val scalableMatrixWithUnitPricingConfig: + JsonField = + JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") - validated = true - } + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") - fun toBuilder() = Builder().from(this) + fun modelType(): ModelType = modelType.getRequired("model_type") - companion object { + /** The name of the price. */ + fun name(): String = name.getRequired("name") - @JvmStatic fun builder() = Builder() - } + fun scalableMatrixWithUnitPricingConfig(): ScalableMatrixWithUnitPricingConfig = + scalableMatrixWithUnitPricingConfig.getRequired( + "scalable_matrix_with_unit_pricing_config" + ) - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - override fun hashCode(): Int = hashCode + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + @JsonProperty("scalable_matrix_with_unit_pricing_config") + @ExcludeMissing + fun _scalableMatrixWithUnitPricingConfig(): + JsonField = scalableMatrixWithUnitPricingConfig - 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 */ - } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, groupedTieredPackageConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance - override fun hashCode(): Int = hashCode + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - 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}" - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - @NoAutoDetect - class NewFloatingScalableMatrixWithUnitPricingPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("scalable_matrix_with_unit_pricing_config") - @ExcludeMissing - private val scalableMatrixWithUnitPricingConfig: - JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration - fun modelType(): ModelType = modelType.getRequired("model_type") + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** The name of the price. */ - fun name(): String = name.getRequired("name") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun scalableMatrixWithUnitPricingConfig(): ScalableMatrixWithUnitPricingConfig = - scalableMatrixWithUnitPricingConfig.getRequired( - "scalable_matrix_with_unit_pricing_config" - ) + private var validated: Boolean = false - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + fun validate(): NewFloatingScalableMatrixWithUnitPricingPrice = apply { + if (validated) { + return@apply + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + cadence() + currency() + itemId() + modelType() + name() + scalableMatrixWithUnitPricingConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("scalable_matrix_with_unit_pricing_config") - @ExcludeMissing - fun _scalableMatrixWithUnitPricingConfig(): JsonField = - scalableMatrixWithUnitPricingConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): NewFloatingScalableMatrixWithUnitPricingPrice = apply { - if (validated) { - return@apply + @JvmStatic fun builder() = Builder() } - cadence() - currency() - itemId() - modelType() - name() - scalableMatrixWithUnitPricingConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { + /** A builder for [NewFloatingScalableMatrixWithUnitPricingPrice]. */ + class Builder internal constructor() { - @JvmStatic fun builder() = Builder() - } + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var scalableMatrixWithUnitPricingConfig: + JsonField? = + null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** A builder for [NewFloatingScalableMatrixWithUnitPricingPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var scalableMatrixWithUnitPricingConfig: - JsonField? = - null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + @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() + } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - fun scalableMatrixWithUnitPricingConfig( - scalableMatrixWithUnitPricingConfig: ScalableMatrixWithUnitPricingConfig - ) = - scalableMatrixWithUnitPricingConfig( - JsonField.of(scalableMatrixWithUnitPricingConfig) - ) + fun scalableMatrixWithUnitPricingConfig( + scalableMatrixWithUnitPricingConfig: ScalableMatrixWithUnitPricingConfig + ) = + scalableMatrixWithUnitPricingConfig( + JsonField.of(scalableMatrixWithUnitPricingConfig) + ) - fun scalableMatrixWithUnitPricingConfig( - scalableMatrixWithUnitPricingConfig: JsonField - ) = apply { - this.scalableMatrixWithUnitPricingConfig = scalableMatrixWithUnitPricingConfig - } + fun scalableMatrixWithUnitPricingConfig( + scalableMatrixWithUnitPricingConfig: + JsonField + ) = apply { + this.scalableMatrixWithUnitPricingConfig = scalableMatrixWithUnitPricingConfig + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + 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 { + keys.forEach(::removeAdditionalProperty) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun build(): NewFloatingScalableMatrixWithUnitPricingPrice = + NewFloatingScalableMatrixWithUnitPricingPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired( + "scalableMatrixWithUnitPricingConfig", + scalableMatrixWithUnitPricingConfig, + ), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - fun build(): NewFloatingScalableMatrixWithUnitPricingPrice = - NewFloatingScalableMatrixWithUnitPricingPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired( - "scalableMatrixWithUnitPricingConfig", - scalableMatrixWithUnitPricingConfig - ), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + companion object { - companion object { + @JvmField val ANNUAL = of("annual") - @JvmField val ANNUAL = of("annual") + @JvmField val SEMI_ANNUAL = of("semi_annual") - @JvmField val SEMI_ANNUAL = of("semi_annual") + @JvmField val MONTHLY = of("monthly") - @JvmField val MONTHLY = of("monthly") + @JvmField val QUARTERLY = of("quarterly") - @JvmField val QUARTERLY = of("quarterly") + @JvmField val ONE_TIME = of("one_time") - @JvmField val ONE_TIME = of("one_time") + @JvmField val CUSTOM = of("custom") - @JvmField val CUSTOM = of("custom") + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - _UNKNOWN, - } + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + fun asString(): String = _value().asStringOrThrow() - fun asString(): String = _value().asStringOrThrow() + 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 Cadence && value == other.value /* spotless:on */ } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + override fun hashCode() = value.hashCode() - override fun hashCode() = value.hashCode() + override fun toString() = value.toString() + } - override fun toString() = value.toString() - } + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { - 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 - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + companion object { - companion object { + @JvmField + val SCALABLE_MATRIX_WITH_UNIT_PRICING = of("scalable_matrix_with_unit_pricing") - @JvmField - val SCALABLE_MATRIX_WITH_UNIT_PRICING = of("scalable_matrix_with_unit_pricing") + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } - @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. */ - 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, + } - /** - * 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. + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. */ - _UNKNOWN, - } + 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, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") - } + fun asString(): String = _value().asStringOrThrow() - fun asString(): String = _value().asStringOrThrow() + 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 ModelType && value == other.value /* spotless:on */ } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + override fun hashCode() = value.hashCode() - override fun hashCode() = value.hashCode() + override fun toString() = value.toString() + } - override fun toString() = value.toString() - } + @NoAutoDetect + class ScalableMatrixWithUnitPricingConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - @NoAutoDetect - class ScalableMatrixWithUnitPricingConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): ScalableMatrixWithUnitPricingConfig = apply { + if (validated) { + return@apply + } - fun validate(): ScalableMatrixWithUnitPricingConfig = apply { - if (validated) { - return@apply + validated = true } - validated = true - } + fun toBuilder() = Builder().from(this) - fun toBuilder() = Builder().from(this) + companion object { - companion object { + @JvmStatic fun builder() = Builder() + } - @JvmStatic fun builder() = Builder() - } + /** A builder for [ScalableMatrixWithUnitPricingConfig]. */ + class Builder internal constructor() { - /** A builder for [ScalableMatrixWithUnitPricingConfig]. */ - class Builder internal constructor() { + private var additionalProperties: MutableMap = mutableMapOf() - private var additionalProperties: MutableMap = mutableMapOf() + @JvmSynthetic + internal fun from( + scalableMatrixWithUnitPricingConfig: ScalableMatrixWithUnitPricingConfig + ) = apply { + additionalProperties = + scalableMatrixWithUnitPricingConfig.additionalProperties.toMutableMap() + } - @JvmSynthetic - internal fun from( - scalableMatrixWithUnitPricingConfig: ScalableMatrixWithUnitPricingConfig - ) = apply { - additionalProperties = - scalableMatrixWithUnitPricingConfig.additionalProperties.toMutableMap() - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - 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 { + keys.forEach(::removeAdditionalProperty) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun build(): ScalableMatrixWithUnitPricingConfig = + ScalableMatrixWithUnitPricingConfig(additionalProperties.toImmutable()) } - fun build(): ScalableMatrixWithUnitPricingConfig = - ScalableMatrixWithUnitPricingConfig(additionalProperties.toImmutable()) - } + 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 ScalableMatrixWithUnitPricingConfig && additionalProperties == other.additionalProperties /* spotless:on */ } - return /* spotless:off */ other is ScalableMatrixWithUnitPricingConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + override fun hashCode(): Int = hashCode - override fun hashCode(): Int = hashCode + override fun toString() = + "ScalableMatrixWithUnitPricingConfig{additionalProperties=$additionalProperties}" + } - override fun toString() = - "ScalableMatrixWithUnitPricingConfig{additionalProperties=$additionalProperties}" - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false - private var validated: Boolean = false + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + duration() + durationUnit() + validated = true } - duration() - durationUnit() - validated = true - } + fun toBuilder() = Builder().from(this) - fun toBuilder() = Builder().from(this) + companion object { - companion object { + @JvmStatic fun builder() = Builder() + } - @JvmStatic fun builder() = Builder() - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - 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() + } - @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)) - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - 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 { + keys.forEach(::removeAdditionalProperty) + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - /** The unit of billing period duration. */ - class DurationUnit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + companion object { - companion object { + @JvmField val DAY = of("day") - @JvmField val DAY = of("day") + @JvmField val MONTH = of("month") - @JvmField val MONTH = of("month") + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. */ - _UNKNOWN, - } + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + fun asString(): String = _value().asStringOrThrow() - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ } - fun asString(): String = _value().asStringOrThrow() + 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 DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + companion object { - override fun hashCode(): Int = hashCode + @JvmStatic fun builder() = Builder() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - private var validated: Boolean = false + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun asString(): String = _value().asStringOrThrow() - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - companion object { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmField val DAY = of("day") + private var validated: Boolean = false - @JvmField val MONTH = of("month") + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + validated = true } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + fun toBuilder() = Builder().from(this) - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, + companion object { + + @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) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN + /** 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) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - fun asString(): String = _value().asStringOrThrow() + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Metadata && 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() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -39211,1416 +40078,1459 @@ private constructor( return true } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + 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 */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, scalableMatrixWithUnitPricingConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + "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}" } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ @NoAutoDetect - class Metadata + class NewFloatingScalableMatrixWithTieredPricingPrice @JsonCreator private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("scalable_matrix_with_tiered_pricing_config") + @ExcludeMissing + private val scalableMatrixWithTieredPricingConfig: + JsonField = + JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") - validated = true - } + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") - fun toBuilder() = Builder().from(this) + fun modelType(): ModelType = modelType.getRequired("model_type") - companion object { + /** The name of the price. */ + fun name(): String = name.getRequired("name") - @JvmStatic fun builder() = Builder() - } + fun scalableMatrixWithTieredPricingConfig(): ScalableMatrixWithTieredPricingConfig = + scalableMatrixWithTieredPricingConfig.getRequired( + "scalable_matrix_with_tiered_pricing_config" + ) - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - override fun hashCode(): Int = hashCode + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + @JsonProperty("scalable_matrix_with_tiered_pricing_config") + @ExcludeMissing + fun _scalableMatrixWithTieredPricingConfig(): + JsonField = + scalableMatrixWithTieredPricingConfig - 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 */ - } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, scalableMatrixWithUnitPricingConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance - override fun hashCode(): Int = hashCode + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - 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}" - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - @NoAutoDetect - class NewFloatingScalableMatrixWithTieredPricingPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("scalable_matrix_with_tiered_pricing_config") - @ExcludeMissing - private val scalableMatrixWithTieredPricingConfig: - JsonField = - JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration - fun modelType(): ModelType = modelType.getRequired("model_type") + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** The name of the price. */ - fun name(): String = name.getRequired("name") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun scalableMatrixWithTieredPricingConfig(): ScalableMatrixWithTieredPricingConfig = - scalableMatrixWithTieredPricingConfig.getRequired( - "scalable_matrix_with_tiered_pricing_config" - ) + private var validated: Boolean = false - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + fun validate(): NewFloatingScalableMatrixWithTieredPricingPrice = apply { + if (validated) { + return@apply + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + cadence() + currency() + itemId() + modelType() + name() + scalableMatrixWithTieredPricingConfig().validate() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonProperty("scalable_matrix_with_tiered_pricing_config") - @ExcludeMissing - fun _scalableMatrixWithTieredPricingConfig(): - JsonField = scalableMatrixWithTieredPricingConfig - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun toBuilder() = Builder().from(this) - private var validated: Boolean = false + companion object { - fun validate(): NewFloatingScalableMatrixWithTieredPricingPrice = apply { - if (validated) { - return@apply + @JvmStatic fun builder() = Builder() } - cadence() - currency() - itemId() - modelType() - name() - scalableMatrixWithTieredPricingConfig().validate() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + /** A builder for [NewFloatingScalableMatrixWithTieredPricingPrice]. */ + class Builder internal constructor() { - fun toBuilder() = Builder().from(this) + private var cadence: JsonField? = null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var scalableMatrixWithTieredPricingConfig: + JsonField? = + null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from( + newFloatingScalableMatrixWithTieredPricingPrice: + NewFloatingScalableMatrixWithTieredPricingPrice + ) = apply { + cadence = newFloatingScalableMatrixWithTieredPricingPrice.cadence + currency = newFloatingScalableMatrixWithTieredPricingPrice.currency + itemId = newFloatingScalableMatrixWithTieredPricingPrice.itemId + modelType = newFloatingScalableMatrixWithTieredPricingPrice.modelType + name = newFloatingScalableMatrixWithTieredPricingPrice.name + scalableMatrixWithTieredPricingConfig = + newFloatingScalableMatrixWithTieredPricingPrice + .scalableMatrixWithTieredPricingConfig + billableMetricId = + newFloatingScalableMatrixWithTieredPricingPrice.billableMetricId + billedInAdvance = + newFloatingScalableMatrixWithTieredPricingPrice.billedInAdvance + billingCycleConfiguration = + newFloatingScalableMatrixWithTieredPricingPrice.billingCycleConfiguration + conversionRate = newFloatingScalableMatrixWithTieredPricingPrice.conversionRate + externalPriceId = + newFloatingScalableMatrixWithTieredPricingPrice.externalPriceId + fixedPriceQuantity = + newFloatingScalableMatrixWithTieredPricingPrice.fixedPriceQuantity + invoiceGroupingKey = + newFloatingScalableMatrixWithTieredPricingPrice.invoiceGroupingKey + invoicingCycleConfiguration = + newFloatingScalableMatrixWithTieredPricingPrice.invoicingCycleConfiguration + metadata = newFloatingScalableMatrixWithTieredPricingPrice.metadata + additionalProperties = + newFloatingScalableMatrixWithTieredPricingPrice.additionalProperties + .toMutableMap() + } - @JvmStatic fun builder() = Builder() - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - /** A builder for [NewFloatingScalableMatrixWithTieredPricingPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var scalableMatrixWithTieredPricingConfig: - JsonField? = - null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - newFloatingScalableMatrixWithTieredPricingPrice: - NewFloatingScalableMatrixWithTieredPricingPrice - ) = apply { - cadence = newFloatingScalableMatrixWithTieredPricingPrice.cadence - currency = newFloatingScalableMatrixWithTieredPricingPrice.currency - itemId = newFloatingScalableMatrixWithTieredPricingPrice.itemId - modelType = newFloatingScalableMatrixWithTieredPricingPrice.modelType - name = newFloatingScalableMatrixWithTieredPricingPrice.name - scalableMatrixWithTieredPricingConfig = - newFloatingScalableMatrixWithTieredPricingPrice - .scalableMatrixWithTieredPricingConfig - billableMetricId = newFloatingScalableMatrixWithTieredPricingPrice.billableMetricId - billedInAdvance = newFloatingScalableMatrixWithTieredPricingPrice.billedInAdvance - billingCycleConfiguration = - newFloatingScalableMatrixWithTieredPricingPrice.billingCycleConfiguration - conversionRate = newFloatingScalableMatrixWithTieredPricingPrice.conversionRate - externalPriceId = newFloatingScalableMatrixWithTieredPricingPrice.externalPriceId - fixedPriceQuantity = - newFloatingScalableMatrixWithTieredPricingPrice.fixedPriceQuantity - invoiceGroupingKey = - newFloatingScalableMatrixWithTieredPricingPrice.invoiceGroupingKey - invoicingCycleConfiguration = - newFloatingScalableMatrixWithTieredPricingPrice.invoicingCycleConfiguration - metadata = newFloatingScalableMatrixWithTieredPricingPrice.metadata - additionalProperties = - newFloatingScalableMatrixWithTieredPricingPrice.additionalProperties - .toMutableMap() - } + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + fun scalableMatrixWithTieredPricingConfig( + scalableMatrixWithTieredPricingConfig: ScalableMatrixWithTieredPricingConfig + ) = + scalableMatrixWithTieredPricingConfig( + JsonField.of(scalableMatrixWithTieredPricingConfig) + ) - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } + fun scalableMatrixWithTieredPricingConfig( + scalableMatrixWithTieredPricingConfig: + JsonField + ) = apply { + this.scalableMatrixWithTieredPricingConfig = + scalableMatrixWithTieredPricingConfig + } - fun scalableMatrixWithTieredPricingConfig( - scalableMatrixWithTieredPricingConfig: ScalableMatrixWithTieredPricingConfig - ) = - scalableMatrixWithTieredPricingConfig( - JsonField.of(scalableMatrixWithTieredPricingConfig) - ) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - fun scalableMatrixWithTieredPricingConfig( - scalableMatrixWithTieredPricingConfig: - JsonField - ) = apply { - this.scalableMatrixWithTieredPricingConfig = scalableMatrixWithTieredPricingConfig - } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + fun build(): NewFloatingScalableMatrixWithTieredPricingPrice = + NewFloatingScalableMatrixWithTieredPricingPrice( + checkRequired("cadence", cadence), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + checkRequired( + "scalableMatrixWithTieredPricingConfig", + scalableMatrixWithTieredPricingConfig, + ), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + /** The cadence to bill for this price on. */ + class Cadence @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`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + companion object { - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JvmField val ANNUAL = of("annual") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + @JvmField val SEMI_ANNUAL = of("semi_annual") - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + @JvmField val MONTHLY = of("monthly") - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + @JvmField val QUARTERLY = of("quarterly") - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + @JvmField val ONE_TIME = of("one_time") - fun build(): NewFloatingScalableMatrixWithTieredPricingPrice = - NewFloatingScalableMatrixWithTieredPricingPrice( - checkRequired("cadence", cadence), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - checkRequired( - "scalableMatrixWithTieredPricingConfig", - scalableMatrixWithTieredPricingConfig - ), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + @JvmField val CUSTOM = of("custom") - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } - companion object { + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - @JvmField val ANNUAL = of("annual") + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - @JvmField val SEMI_ANNUAL = of("semi_annual") + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - @JvmField val MONTHLY = of("monthly") + fun asString(): String = _value().asStringOrThrow() - @JvmField val QUARTERLY = of("quarterly") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val ONE_TIME = of("one_time") + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } - @JvmField val CUSTOM = of("custom") + override fun hashCode() = value.hashCode() - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + override fun toString() = value.toString() } - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. */ - _UNKNOWN, - } + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN + companion object { + + @JvmField + val SCALABLE_MATRIX_WITH_TIERED_PRICING = + of("scalable_matrix_with_tiered_pricing") + + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $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, } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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") + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun asString(): String = _value().asStringOrThrow() - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - override fun hashCode() = value.hashCode() + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + } - override fun toString() = value.toString() - } + override fun hashCode() = value.hashCode() - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + override fun toString() = value.toString() + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @NoAutoDetect + class ScalableMatrixWithTieredPricingConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - companion object { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmField - val SCALABLE_MATRIX_WITH_TIERED_PRICING = of("scalable_matrix_with_tiered_pricing") + private var validated: Boolean = false - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + fun validate(): ScalableMatrixWithTieredPricingConfig = apply { + if (validated) { + return@apply + } - /** An enum containing [ModelType]'s known values. */ - enum class Known { - SCALABLE_MATRIX_WITH_TIERED_PRICING, - } + validated = true + } - /** - * 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, - } + fun toBuilder() = Builder().from(this) - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 - } + companion object { - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") + @JvmStatic fun builder() = Builder() } - fun asString(): String = _value().asStringOrThrow() + /** A builder for [ScalableMatrixWithTieredPricingConfig]. */ + class Builder internal constructor() { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var additionalProperties: MutableMap = mutableMapOf() - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + @JvmSynthetic + internal fun from( + scalableMatrixWithTieredPricingConfig: ScalableMatrixWithTieredPricingConfig + ) = apply { + additionalProperties = + scalableMatrixWithTieredPricingConfig.additionalProperties + .toMutableMap() + } - override fun hashCode() = value.hashCode() + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - override fun toString() = value.toString() - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @NoAutoDetect - class ScalableMatrixWithTieredPricingConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - private var validated: Boolean = false + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun validate(): ScalableMatrixWithTieredPricingConfig = apply { - if (validated) { - return@apply + fun build(): ScalableMatrixWithTieredPricingConfig = + ScalableMatrixWithTieredPricingConfig(additionalProperties.toImmutable()) } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + return /* spotless:off */ other is ScalableMatrixWithTieredPricingConfig && additionalProperties == other.additionalProperties /* spotless:on */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - @JvmStatic fun builder() = Builder() + override fun hashCode(): Int = hashCode + + override fun toString() = + "ScalableMatrixWithTieredPricingConfig{additionalProperties=$additionalProperties}" } - /** A builder for [ScalableMatrixWithTieredPricingConfig]. */ - class Builder internal constructor() { + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - private var additionalProperties: MutableMap = mutableMapOf() + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - @JvmSynthetic - internal fun from( - scalableMatrixWithTieredPricingConfig: ScalableMatrixWithTieredPricingConfig - ) = apply { - additionalProperties = - scalableMatrixWithTieredPricingConfig.additionalProperties.toMutableMap() - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + duration() + durationUnit() + validated = true } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun toBuilder() = Builder().from(this) - fun build(): ScalableMatrixWithTieredPricingConfig = - ScalableMatrixWithTieredPricingConfig(additionalProperties.toImmutable()) - } + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is ScalableMatrixWithTieredPricingConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun hashCode(): Int = hashCode + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - override fun toString() = - "ScalableMatrixWithTieredPricingConfig{additionalProperties=$additionalProperties}" - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - private var validated: Boolean = false + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun validate(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun asString(): String = _value().asStringOrThrow() - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun asString(): String = _value().asStringOrThrow() + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + duration() + durationUnit() + validated = true } - override fun hashCode() = value.hashCode() + fun toBuilder() = Builder().from(this) - override fun toString() = value.toString() - } + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun hashCode(): Int = hashCode + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - private var validated: Boolean = false + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun asString(): String = _value().asStringOrThrow() - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - companion object { + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmField val DAY = of("day") + private var validated: Boolean = false - @JvmField val MONTH = of("month") + fun validate(): Metadata = apply { + if (validated) { + return@apply + } - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + validated = true } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + /** 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) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - fun asString(): String = _value().asStringOrThrow() + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Metadata && 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() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -40628,1395 +41538,1430 @@ private constructor( return true } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + 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 */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, scalableMatrixWithTieredPricingConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + "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}" } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ @NoAutoDetect - class Metadata + class NewFloatingCumulativeGroupedBulkPrice @JsonCreator private constructor( + @JsonProperty("cadence") + @ExcludeMissing + private val cadence: JsonField = JsonMissing.of(), + @JsonProperty("cumulative_grouped_bulk_config") + @ExcludeMissing + private val cumulativeGroupedBulkConfig: JsonField = + JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("item_id") + @ExcludeMissing + private val itemId: JsonField = JsonMissing.of(), + @JsonProperty("model_type") + @ExcludeMissing + private val modelType: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("billable_metric_id") + @ExcludeMissing + private val billableMetricId: JsonField = JsonMissing.of(), + @JsonProperty("billed_in_advance") + @ExcludeMissing + private val billedInAdvance: JsonField = JsonMissing.of(), + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + private val billingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("conversion_rate") + @ExcludeMissing + private val conversionRate: JsonField = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + private val externalPriceId: JsonField = JsonMissing.of(), + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + private val fixedPriceQuantity: JsonField = JsonMissing.of(), + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + private val invoiceGroupingKey: JsonField = JsonMissing.of(), + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + private val invoicingCycleConfiguration: JsonField = + JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") - private var validated: Boolean = false + fun cumulativeGroupedBulkConfig(): CumulativeGroupedBulkConfig = + cumulativeGroupedBulkConfig.getRequired("cumulative_grouped_bulk_config") - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") - validated = true - } + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") - fun toBuilder() = Builder().from(this) + fun modelType(): ModelType = modelType.getRequired("model_type") - companion object { + /** The name of the price. */ + fun name(): String = name.getRequired("name") - @JvmStatic fun builder() = Builder() - } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) - /** A builder for [Metadata]. */ - class Builder internal constructor() { + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) - private var additionalProperties: MutableMap = mutableMapOf() + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + @JsonProperty("cumulative_grouped_bulk_config") + @ExcludeMissing + fun _cumulativeGroupedBulkConfig(): JsonField = + cumulativeGroupedBulkConfig - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - override fun hashCode(): Int = hashCode + @JsonProperty("model_type") + @ExcludeMissing + fun _modelType(): JsonField = modelType - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId(): JsonField = billableMetricId - 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 */ - } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance(): JsonField = billedInAdvance - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, currency, itemId, modelType, name, scalableMatrixWithTieredPricingConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration(): JsonField = + billingCycleConfiguration - override fun hashCode(): Int = hashCode + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate(): JsonField = conversionRate - 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}" - } + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId - @NoAutoDetect - class NewFloatingCumulativeGroupedBulkPrice - @JsonCreator - private constructor( - @JsonProperty("cadence") - @ExcludeMissing - private val cadence: JsonField = JsonMissing.of(), - @JsonProperty("cumulative_grouped_bulk_config") - @ExcludeMissing - private val cumulativeGroupedBulkConfig: JsonField = - JsonMissing.of(), - @JsonProperty("currency") - @ExcludeMissing - private val currency: JsonField = JsonMissing.of(), - @JsonProperty("item_id") - @ExcludeMissing - private val itemId: JsonField = JsonMissing.of(), - @JsonProperty("model_type") - @ExcludeMissing - private val modelType: JsonField = JsonMissing.of(), - @JsonProperty("name") - @ExcludeMissing - private val name: JsonField = JsonMissing.of(), - @JsonProperty("billable_metric_id") - @ExcludeMissing - private val billableMetricId: JsonField = JsonMissing.of(), - @JsonProperty("billed_in_advance") - @ExcludeMissing - private val billedInAdvance: JsonField = JsonMissing.of(), - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - private val billingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("conversion_rate") - @ExcludeMissing - private val conversionRate: JsonField = JsonMissing.of(), - @JsonProperty("external_price_id") - @ExcludeMissing - private val externalPriceId: JsonField = JsonMissing.of(), - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - private val fixedPriceQuantity: JsonField = JsonMissing.of(), - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - private val invoiceGroupingKey: JsonField = JsonMissing.of(), - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - private val invoicingCycleConfiguration: JsonField = - JsonMissing.of(), - @JsonProperty("metadata") - @ExcludeMissing - private val metadata: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration(): JsonField = + invoicingCycleConfiguration + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata - /** The cadence to bill for this price on. */ - fun cadence(): Cadence = cadence.getRequired("cadence") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun cumulativeGroupedBulkConfig(): CumulativeGroupedBulkConfig = - cumulativeGroupedBulkConfig.getRequired("cumulative_grouped_bulk_config") + private var validated: Boolean = false - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(): String = currency.getRequired("currency") + fun validate(): NewFloatingCumulativeGroupedBulkPrice = apply { + if (validated) { + return@apply + } - /** The id of the item the plan will be associated with. */ - fun itemId(): String = itemId.getRequired("item_id") + cadence() + cumulativeGroupedBulkConfig().validate() + currency() + itemId() + modelType() + name() + billableMetricId() + billedInAdvance() + billingCycleConfiguration().ifPresent { it.validate() } + conversionRate() + externalPriceId() + fixedPriceQuantity() + invoiceGroupingKey() + invoicingCycleConfiguration().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } + validated = true + } - fun modelType(): ModelType = modelType.getRequired("model_type") + fun toBuilder() = Builder().from(this) - /** The name of the price. */ - fun name(): String = name.getRequired("name") + companion object { - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - fun billableMetricId(): Optional = - Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + @JvmStatic fun builder() = Builder() + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(): Optional = - Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + /** A builder for [NewFloatingCumulativeGroupedBulkPrice]. */ + class Builder internal constructor() { - /** For custom cadence: specifies the duration of the billing period in days or months. */ - fun billingCycleConfiguration(): Optional = - Optional.ofNullable( - billingCycleConfiguration.getNullable("billing_cycle_configuration") - ) + private var cadence: JsonField? = null + private var cumulativeGroupedBulkConfig: JsonField? = + null + private var currency: JsonField? = null + private var itemId: JsonField? = null + private var modelType: JsonField? = null + private var name: JsonField? = null + private var billableMetricId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(): Optional = - Optional.ofNullable(conversionRate.getNullable("conversion_rate")) - - /** An alias for the price. */ - fun externalPriceId(): Optional = - Optional.ofNullable(externalPriceId.getNullable("external_price_id")) - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - fun fixedPriceQuantity(): Optional = - Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) - - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(): Optional = - Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration(): Optional = - Optional.ofNullable( - invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") - ) + @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() + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata")) - - /** The cadence to bill for this price on. */ - @JsonProperty("cadence") @ExcludeMissing fun _cadence(): JsonField = cadence - - @JsonProperty("cumulative_grouped_bulk_config") - @ExcludeMissing - fun _cumulativeGroupedBulkConfig(): JsonField = - cumulativeGroupedBulkConfig - - /** An ISO 4217 currency string for which this price is billed in. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency - - /** The id of the item the plan will be associated with. */ - @JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId - - @JsonProperty("model_type") - @ExcludeMissing - fun _modelType(): JsonField = modelType - - /** The name of the price. */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** The id of the billable metric for the price. Only needed if the price is usage-based. */ - @JsonProperty("billable_metric_id") - @ExcludeMissing - fun _billableMetricId(): JsonField = billableMetricId - - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @JsonProperty("billed_in_advance") - @ExcludeMissing - fun _billedInAdvance(): JsonField = billedInAdvance - - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @JsonProperty("billing_cycle_configuration") - @ExcludeMissing - fun _billingCycleConfiguration(): JsonField = - billingCycleConfiguration - - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @JsonProperty("conversion_rate") - @ExcludeMissing - fun _conversionRate(): JsonField = conversionRate - - /** An alias for the price. */ - @JsonProperty("external_price_id") - @ExcludeMissing - fun _externalPriceId(): JsonField = externalPriceId - - /** If the Price represents a fixed cost, this represents the quantity of units applied. */ - @JsonProperty("fixed_price_quantity") - @ExcludeMissing - fun _fixedPriceQuantity(): JsonField = fixedPriceQuantity - - /** The property used to group this price on an invoice */ - @JsonProperty("invoice_grouping_key") - @ExcludeMissing - fun _invoiceGroupingKey(): JsonField = invoiceGroupingKey - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @JsonProperty("invoicing_cycle_configuration") - @ExcludeMissing - fun _invoicingCycleConfiguration(): JsonField = - invoicingCycleConfiguration - - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) - private var validated: Boolean = false + /** The cadence to bill for this price on. */ + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } - fun validate(): NewFloatingCumulativeGroupedBulkPrice = apply { - if (validated) { - return@apply - } + fun cumulativeGroupedBulkConfig( + cumulativeGroupedBulkConfig: CumulativeGroupedBulkConfig + ) = cumulativeGroupedBulkConfig(JsonField.of(cumulativeGroupedBulkConfig)) - cadence() - cumulativeGroupedBulkConfig().validate() - currency() - itemId() - modelType() - name() - billableMetricId() - billedInAdvance() - billingCycleConfiguration().ifPresent { it.validate() } - conversionRate() - externalPriceId() - fixedPriceQuantity() - invoiceGroupingKey() - invoicingCycleConfiguration().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } - validated = true - } + fun cumulativeGroupedBulkConfig( + cumulativeGroupedBulkConfig: JsonField + ) = apply { this.cumulativeGroupedBulkConfig = cumulativeGroupedBulkConfig } - fun toBuilder() = Builder().from(this) + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - companion object { + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: JsonField) = apply { this.currency = currency } - @JvmStatic fun builder() = Builder() - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) - /** A builder for [NewFloatingCumulativeGroupedBulkPrice]. */ - class Builder internal constructor() { - - private var cadence: JsonField? = null - private var cumulativeGroupedBulkConfig: JsonField? = null - private var currency: JsonField? = null - private var itemId: JsonField? = null - private var modelType: JsonField? = null - private var name: JsonField? = null - private var billableMetricId: JsonField = JsonMissing.of() - private var billedInAdvance: JsonField = JsonMissing.of() - private var billingCycleConfiguration: JsonField = - JsonMissing.of() - private var conversionRate: JsonField = JsonMissing.of() - private var externalPriceId: JsonField = JsonMissing.of() - private var fixedPriceQuantity: JsonField = JsonMissing.of() - private var invoiceGroupingKey: JsonField = JsonMissing.of() - private var invoicingCycleConfiguration: JsonField = - JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() - 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() - } + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } - /** The cadence to bill for this price on. */ - fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) - /** The cadence to bill for this price on. */ - fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } - fun cumulativeGroupedBulkConfig( - cumulativeGroupedBulkConfig: CumulativeGroupedBulkConfig - ) = cumulativeGroupedBulkConfig(JsonField.of(cumulativeGroupedBulkConfig)) + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) - fun cumulativeGroupedBulkConfig( - cumulativeGroupedBulkConfig: JsonField - ) = apply { this.cumulativeGroupedBulkConfig = cumulativeGroupedBulkConfig } + /** The name of the price. */ + fun name(name: JsonField) = apply { this.name = name } - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String?) = + billableMetricId(JsonField.ofNullable(billableMetricId)) - /** An ISO 4217 currency string for which this price is billed in. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: Optional) = + billableMetricId(billableMetricId.orElse(null)) - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } - /** The id of the item the plan will be associated with. */ - fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean?) = + billedInAdvance(JsonField.ofNullable(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(billedInAdvance as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun billedInAdvance(billedInAdvance: Optional) = + billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration? + ) = billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) - fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: Optional + ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) - fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } - /** The name of the price. */ - fun name(name: String) = name(JsonField.of(name)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double?) = + conversionRate(JsonField.ofNullable(conversionRate)) - /** The name of the price. */ - fun name(name: JsonField) = apply { this.name = name } + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(conversionRate as Double?) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: String?) = - billableMetricId(JsonField.ofNullable(billableMetricId)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun conversionRate(conversionRate: Optional) = + conversionRate(conversionRate.orElse(null) as Double?) - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: Optional) = - billableMetricId(billableMetricId.orElse(null)) + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } - /** - * The id of the billable metric for the price. Only needed if the price is usage-based. - */ - fun billableMetricId(billableMetricId: JsonField) = apply { - this.billableMetricId = billableMetricId - } + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean?) = - billedInAdvance(JsonField.ofNullable(billedInAdvance)) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.orElse(null)) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: Boolean) = - billedInAdvance(billedInAdvance as Boolean?) + /** An alias for the price. */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun billedInAdvance(billedInAdvance: Optional) = - billedInAdvance(billedInAdvance.orElse(null) as Boolean?) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double?) = + fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) - /** - * If the Price represents a fixed cost, the price will be billed in-advance if this is - * true, and in-arrears if this is false. - */ - fun billedInAdvance(billedInAdvance: JsonField) = apply { - this.billedInAdvance = billedInAdvance - } + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(fixedPriceQuantity as Double?) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration?) = - billingCycleConfiguration(JsonField.ofNullable(billingCycleConfiguration)) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun fixedPriceQuantity(fixedPriceQuantity: Optional) = + fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: Optional - ) = billingCycleConfiguration(billingCycleConfiguration.orElse(null)) + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } - /** - * For custom cadence: specifies the duration of the billing period in days or months. - */ - fun billingCycleConfiguration( - billingCycleConfiguration: JsonField - ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String?) = + invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double?) = - conversionRate(JsonField.ofNullable(conversionRate)) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: Optional) = + invoiceGroupingKey(invoiceGroupingKey.orElse(null)) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: Double) = conversionRate(conversionRate as Double?) + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } - /** The per unit conversion rate of the price currency to the invoicing currency. */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun conversionRate(conversionRate: Optional) = - conversionRate(conversionRate.orElse(null) as Double?) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration? + ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - /** The per unit conversion rate of the price currency to the invoicing currency. */ - fun conversionRate(conversionRate: JsonField) = apply { - this.conversionRate = conversionRate - } + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: Optional + ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) - /** An alias for the price. */ - fun externalPriceId(externalPriceId: String?) = - externalPriceId(JsonField.ofNullable(externalPriceId)) + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } - /** An alias for the price. */ - fun externalPriceId(externalPriceId: Optional) = - externalPriceId(externalPriceId.orElse(null)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) - /** An alias for the price. */ - fun externalPriceId(externalPriceId: JsonField) = apply { - this.externalPriceId = externalPriceId - } + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double?) = - fixedPriceQuantity(JsonField.ofNullable(fixedPriceQuantity)) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: Double) = - fixedPriceQuantity(fixedPriceQuantity as Double?) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 - fun fixedPriceQuantity(fixedPriceQuantity: Optional) = - fixedPriceQuantity(fixedPriceQuantity.orElse(null) as Double?) + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * If the Price represents a fixed cost, this represents the quantity of units applied. - */ - fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { - this.fixedPriceQuantity = fixedPriceQuantity - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: String?) = - invoiceGroupingKey(JsonField.ofNullable(invoiceGroupingKey)) + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: Optional) = - invoiceGroupingKey(invoiceGroupingKey.orElse(null)) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - /** The property used to group this price on an invoice */ - fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { - this.invoiceGroupingKey = invoiceGroupingKey + fun build(): NewFloatingCumulativeGroupedBulkPrice = + NewFloatingCumulativeGroupedBulkPrice( + checkRequired("cadence", cadence), + checkRequired("cumulativeGroupedBulkConfig", cumulativeGroupedBulkConfig), + checkRequired("currency", currency), + checkRequired("itemId", itemId), + checkRequired("modelType", modelType), + checkRequired("name", name), + billableMetricId, + billedInAdvance, + billingCycleConfiguration, + conversionRate, + externalPriceId, + fixedPriceQuantity, + invoiceGroupingKey, + invoicingCycleConfiguration, + metadata, + additionalProperties.toImmutable(), + ) } - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: InvoicingCycleConfiguration? - ) = invoicingCycleConfiguration(JsonField.ofNullable(invoicingCycleConfiguration)) - - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: Optional - ) = invoicingCycleConfiguration(invoicingCycleConfiguration.orElse(null)) + /** The cadence to bill for this price on. */ + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - fun invoicingCycleConfiguration( - invoicingCycleConfiguration: JsonField - ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + companion object { - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: Optional) = metadata(metadata.orElse(null)) + @JvmField val ANNUAL = of("annual") - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by - * setting `metadata` to `null`. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + @JvmField val SEMI_ANNUAL = of("semi_annual") - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JvmField val MONTHLY = of("monthly") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + @JvmField val QUARTERLY = of("quarterly") - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + @JvmField val ONE_TIME = of("one_time") - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + @JvmField val CUSTOM = of("custom") - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } - fun build(): NewFloatingCumulativeGroupedBulkPrice = - NewFloatingCumulativeGroupedBulkPrice( - checkRequired("cadence", cadence), - checkRequired("cumulativeGroupedBulkConfig", cumulativeGroupedBulkConfig), - checkRequired("currency", currency), - checkRequired("itemId", itemId), - checkRequired("modelType", modelType), - checkRequired("name", name), - billableMetricId, - billedInAdvance, - billingCycleConfiguration, - conversionRate, - externalPriceId, - fixedPriceQuantity, - invoiceGroupingKey, - invoicingCycleConfiguration, - metadata, - additionalProperties.toImmutable(), - ) - } + /** An enum containing [Cadence]'s known values. */ + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } - /** The cadence to bill for this price on. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + /** + * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Cadence] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + /** + * An enum member indicating that [Cadence] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } - @JvmField val ANNUAL = of("annual") + fun asString(): String = _value().asStringOrThrow() - @JvmField val SEMI_ANNUAL = of("semi_annual") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val MONTHLY = of("monthly") + return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ + } - @JvmField val QUARTERLY = of("quarterly") + override fun hashCode() = value.hashCode() - @JvmField val ONE_TIME = of("one_time") + override fun toString() = value.toString() + } - @JvmField val CUSTOM = of("custom") + @NoAutoDetect + class CumulativeGroupedBulkConfig + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** An enum containing [Cadence]'s known values. */ - enum class Known { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - } + private var validated: Boolean = false - /** - * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Cadence] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ANNUAL, - SEMI_ANNUAL, - MONTHLY, - QUARTERLY, - ONE_TIME, - CUSTOM, - /** - * An enum member indicating that [Cadence] was instantiated with an unknown value. - */ - _UNKNOWN, - } + fun validate(): CumulativeGroupedBulkConfig = apply { + if (validated) { + return@apply + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ANNUAL -> Value.ANNUAL - SEMI_ANNUAL -> Value.SEMI_ANNUAL - MONTHLY -> Value.MONTHLY - QUARTERLY -> Value.QUARTERLY - ONE_TIME -> Value.ONE_TIME - CUSTOM -> Value.CUSTOM - else -> Value._UNKNOWN + validated = true } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ANNUAL -> Known.ANNUAL - SEMI_ANNUAL -> Known.SEMI_ANNUAL - MONTHLY -> Known.MONTHLY - QUARTERLY -> Known.QUARTERLY - ONE_TIME -> Known.ONE_TIME - CUSTOM -> Known.CUSTOM - else -> throw OrbInvalidDataException("Unknown Cadence: $value") - } + fun toBuilder() = Builder().from(this) - fun asString(): String = _value().asStringOrThrow() + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is Cadence && value == other.value /* spotless:on */ - } + /** A builder for [CumulativeGroupedBulkConfig]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() - override fun hashCode() = value.hashCode() + @JvmSynthetic + internal fun from(cumulativeGroupedBulkConfig: CumulativeGroupedBulkConfig) = + apply { + additionalProperties = + cumulativeGroupedBulkConfig.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - override fun toString() = value.toString() - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @NoAutoDetect - class CumulativeGroupedBulkConfig - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - private var validated: Boolean = false + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun validate(): CumulativeGroupedBulkConfig = apply { - if (validated) { - return@apply + fun build(): CumulativeGroupedBulkConfig = + CumulativeGroupedBulkConfig(additionalProperties.toImmutable()) } - validated = true - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun toBuilder() = Builder().from(this) + return /* spotless:off */ other is CumulativeGroupedBulkConfig && additionalProperties == other.additionalProperties /* spotless:on */ + } - companion object { + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ - @JvmStatic fun builder() = Builder() + override fun hashCode(): Int = hashCode + + override fun toString() = + "CumulativeGroupedBulkConfig{additionalProperties=$additionalProperties}" } - /** A builder for [CumulativeGroupedBulkConfig]. */ - class Builder internal constructor() { + class ModelType @JsonCreator private constructor(private val value: JsonField) : + Enum { - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - @JvmSynthetic - internal fun from(cumulativeGroupedBulkConfig: CumulativeGroupedBulkConfig) = - apply { - additionalProperties = - cumulativeGroupedBulkConfig.additionalProperties.toMutableMap() - } + companion object { - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JvmField val CUMULATIVE_GROUPED_BULK = of("cumulative_grouped_bulk") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + /** An enum containing [ModelType]'s known values. */ + enum class Known { + CUMULATIVE_GROUPED_BULK } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** + * 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, } - fun build(): CumulativeGroupedBulkConfig = - CumulativeGroupedBulkConfig(additionalProperties.toImmutable()) - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead 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 + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to 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") + } - return /* spotless:off */ other is CumulativeGroupedBulkConfig && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun asString(): String = _value().asStringOrThrow() - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - override fun hashCode(): Int = hashCode + return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ + } - override fun toString() = - "CumulativeGroupedBulkConfig{additionalProperties=$additionalProperties}" - } + override fun hashCode() = value.hashCode() - class ModelType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + override fun toString() = value.toString() + } /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. + * For custom cadence: specifies the duration of the billing period in days or months. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @NoAutoDetect + class BillingCycleConfiguration + @JsonCreator + private constructor( + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - companion object { + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - @JvmField val CUMULATIVE_GROUPED_BULK = of("cumulative_grouped_bulk") + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - /** An enum containing [ModelType]'s known values. */ - enum class Known { - CUMULATIVE_GROUPED_BULK, - } + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** - * 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, - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead 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 - } + private var validated: Boolean = false - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to 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") + fun validate(): BillingCycleConfiguration = apply { + if (validated) { + return@apply + } + + duration() + durationUnit() + validated = true } - fun asString(): String = _value().asStringOrThrow() + fun toBuilder() = Builder().from(this) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + companion object { + + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is ModelType && value == other.value /* spotless:on */ - } + /** A builder for [BillingCycleConfiguration]. */ + class Builder internal constructor() { - override fun hashCode() = value.hashCode() + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun toString() = value.toString() - } + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + duration = billingCycleConfiguration.duration + durationUnit = billingCycleConfiguration.durationUnit + additionalProperties = + billingCycleConfiguration.additionalProperties.toMutableMap() + } - /** For custom cadence: specifies the duration of the billing period in days or months. */ - @NoAutoDetect - class BillingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + 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(): BillingCycleConfiguration = apply { - if (validated) { - return@apply + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [BillingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { - duration = billingCycleConfiguration.duration - durationUnit = billingCycleConfiguration.durationUnit - additionalProperties = - billingCycleConfiguration.additionalProperties.toMutableMap() - } + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, + } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun hashCode() = value.hashCode() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): BillingCycleConfiguration = - BillingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @NoAutoDetect + class InvoicingCycleConfiguration @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DAY = of("day") - - @JvmField val MONTH = of("month") + @JsonProperty("duration") + @ExcludeMissing + private val duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + private val durationUnit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) - } + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun _duration(): JsonField = duration - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN - } + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun asString(): String = _value().asStringOrThrow() + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun validate(): InvoicingCycleConfiguration = apply { + if (validated) { + return@apply } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + duration() + durationUnit() + validated = true } - override fun hashCode() = value.hashCode() + fun toBuilder() = Builder().from(this) - override fun toString() = value.toString() - } + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is BillingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** A builder for [InvoicingCycleConfiguration]. */ + class Builder internal constructor() { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } - /* spotless:on */ + private var duration: JsonField? = null + private var durationUnit: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun hashCode(): Int = hashCode + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + duration = invoicingCycleConfiguration.duration + durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties = + invoicingCycleConfiguration.additionalProperties.toMutableMap() + } - override fun toString() = - "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" - } + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) - /** - * Within each billing cycle, specifies the cadence at which invoices are produced. If - * unspecified, a single invoice is produced per billing cycle. - */ - @NoAutoDetect - class InvoicingCycleConfiguration - @JsonCreator - private constructor( - @JsonProperty("duration") - @ExcludeMissing - private val duration: JsonField = JsonMissing.of(), - @JsonProperty("duration_unit") - @ExcludeMissing - private val durationUnit: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + /** The duration of the billing period. */ + fun duration(duration: JsonField) = apply { this.duration = duration } - /** The duration of the billing period. */ - fun duration(): Long = duration.getRequired("duration") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) - /** The unit of billing period duration. */ - fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } - /** The duration of the billing period. */ - @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The unit of billing period duration. */ - @JsonProperty("duration_unit") - @ExcludeMissing - fun _durationUnit(): JsonField = durationUnit + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - private var validated: Boolean = false + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun validate(): InvoicingCycleConfiguration = apply { - if (validated) { - return@apply + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkRequired("duration", duration), + checkRequired("durationUnit", durationUnit), + additionalProperties.toImmutable(), + ) } - duration() - durationUnit() - validated = true - } + /** The unit of billing period duration. */ + class DurationUnit + @JsonCreator + private constructor(private val value: JsonField) : Enum { - fun toBuilder() = Builder().from(this) + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value - companion object { + companion object { - @JvmStatic fun builder() = Builder() - } + @JvmField val DAY = of("day") - /** A builder for [InvoicingCycleConfiguration]. */ - class Builder internal constructor() { + @JvmField val MONTH = of("month") - private var duration: JsonField? = null - private var durationUnit: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } - @JvmSynthetic - internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = - apply { - duration = invoicingCycleConfiguration.duration - durationUnit = invoicingCycleConfiguration.durationUnit - additionalProperties = - invoicingCycleConfiguration.additionalProperties.toMutableMap() + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAY, + MONTH, } - /** The duration of the billing period. */ - fun duration(duration: Long) = duration(JsonField.of(duration)) + /** + * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DurationUnit] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DAY, + MONTH, + /** + * An enum member indicating that [DurationUnit] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } - /** The duration of the billing period. */ - fun duration(duration: JsonField) = apply { this.duration = duration } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: DurationUnit) = - durationUnit(JsonField.of(durationUnit)) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } - /** The unit of billing period duration. */ - fun durationUnit(durationUnit: JsonField) = apply { - this.durationUnit = durationUnit - } + fun asString(): String = _value().asStringOrThrow() - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) + return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + /* spotless:on */ - fun build(): InvoicingCycleConfiguration = - InvoicingCycleConfiguration( - checkRequired("duration", duration), - checkRequired("durationUnit", durationUnit), - additionalProperties.toImmutable(), - ) + override fun hashCode(): Int = hashCode + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - /** The unit of billing period duration. */ - class DurationUnit + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @NoAutoDetect + class Metadata @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - companion object { + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + validated = true + } - @JvmField val DAY = of("day") + fun toBuilder() = Builder().from(this) - @JvmField val MONTH = of("month") + companion object { - @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + @JvmStatic fun builder() = Builder() } - /** An enum containing [DurationUnit]'s known values. */ - enum class Known { - DAY, - MONTH, - } + /** 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) + } - /** - * An enum containing [DurationUnit]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DurationUnit] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DAY, - MONTH, - /** - * An enum member indicating that [DurationUnit] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DAY -> Value.DAY - MONTH -> Value.MONTH - else -> Value._UNKNOWN + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws OrbInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DAY -> Known.DAY - MONTH -> Known.MONTH - else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - fun asString(): String = _value().asStringOrThrow() + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is DurationUnit && value == other.value /* spotless:on */ + return /* spotless:off */ other is Metadata && 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() = "Metadata{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -42024,121 +42969,282 @@ private constructor( return true } - return /* spotless:off */ other is InvoicingCycleConfiguration && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + 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 */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(duration, durationUnit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, cumulativeGroupedBulkConfig, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + "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}" } + } - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by - * setting the value to `null`, and the entire metadata mapping can be cleared by setting - * `metadata` to `null`. - */ - @NoAutoDetect - class Metadata - @JsonCreator - private constructor( - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun toBuilder() = Builder().from(this) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + companion object { - private var validated: Boolean = false + @JvmStatic fun builder() = Builder() + } - fun validate(): Metadata = apply { - if (validated) { - return@apply - } + /** A builder for [PriceCreateParams]. */ + @NoAutoDetect + class Builder internal constructor() { - validated = true - } + private var body: Body? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - fun toBuilder() = Builder().from(this) + @JvmSynthetic + internal fun from(priceCreateParams: PriceCreateParams) = apply { + body = priceCreateParams.body + additionalHeaders = priceCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = priceCreateParams.additionalQueryParams.toBuilder() + } - companion object { + fun body(body: Body) = apply { this.body = body } - @JvmStatic fun builder() = Builder() - } + fun body(newFloatingUnitPrice: Body.NewFloatingUnitPrice) = + body(Body.ofNewFloatingUnitPrice(newFloatingUnitPrice)) - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun body(newFloatingPackagePrice: Body.NewFloatingPackagePrice) = + body(Body.ofNewFloatingPackagePrice(newFloatingPackagePrice)) - private var additionalProperties: MutableMap = mutableMapOf() + fun body(newFloatingMatrixPrice: Body.NewFloatingMatrixPrice) = + body(Body.ofNewFloatingMatrixPrice(newFloatingMatrixPrice)) - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + fun body(newFloatingMatrixWithAllocationPrice: Body.NewFloatingMatrixWithAllocationPrice) = + body(Body.ofNewFloatingMatrixWithAllocationPrice(newFloatingMatrixWithAllocationPrice)) - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun body(newFloatingTieredPrice: Body.NewFloatingTieredPrice) = + body(Body.ofNewFloatingTieredPrice(newFloatingTieredPrice)) - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun body(newFloatingTieredBpsPrice: Body.NewFloatingTieredBpsPrice) = + body(Body.ofNewFloatingTieredBpsPrice(newFloatingTieredBpsPrice)) - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun body(newFloatingBpsPrice: Body.NewFloatingBpsPrice) = + body(Body.ofNewFloatingBpsPrice(newFloatingBpsPrice)) - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + fun body(newFloatingBulkBpsPrice: Body.NewFloatingBulkBpsPrice) = + body(Body.ofNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice)) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun body(newFloatingBulkPrice: Body.NewFloatingBulkPrice) = + body(Body.ofNewFloatingBulkPrice(newFloatingBulkPrice)) - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } + fun body(newFloatingThresholdTotalAmountPrice: Body.NewFloatingThresholdTotalAmountPrice) = + body(Body.ofNewFloatingThresholdTotalAmountPrice(newFloatingThresholdTotalAmountPrice)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun body(newFloatingTieredPackagePrice: Body.NewFloatingTieredPackagePrice) = + body(Body.ofNewFloatingTieredPackagePrice(newFloatingTieredPackagePrice)) - return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */ - } + fun body(newFloatingGroupedTieredPrice: Body.NewFloatingGroupedTieredPrice) = + body(Body.ofNewFloatingGroupedTieredPrice(newFloatingGroupedTieredPrice)) - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /* spotless:on */ + fun body( + newFloatingMaxGroupTieredPackagePrice: Body.NewFloatingMaxGroupTieredPackagePrice + ) = + body( + Body.ofNewFloatingMaxGroupTieredPackagePrice(newFloatingMaxGroupTieredPackagePrice) + ) - override fun hashCode(): Int = hashCode + fun body(newFloatingTieredWithMinimumPrice: Body.NewFloatingTieredWithMinimumPrice) = + body(Body.ofNewFloatingTieredWithMinimumPrice(newFloatingTieredWithMinimumPrice)) + + fun body( + newFloatingPackageWithAllocationPrice: Body.NewFloatingPackageWithAllocationPrice + ) = + body( + Body.ofNewFloatingPackageWithAllocationPrice(newFloatingPackageWithAllocationPrice) + ) + + fun body( + newFloatingTieredPackageWithMinimumPrice: Body.NewFloatingTieredPackageWithMinimumPrice + ) = + body( + Body.ofNewFloatingTieredPackageWithMinimumPrice( + newFloatingTieredPackageWithMinimumPrice + ) + ) + + fun body(newFloatingUnitWithPercentPrice: Body.NewFloatingUnitWithPercentPrice) = + body(Body.ofNewFloatingUnitWithPercentPrice(newFloatingUnitWithPercentPrice)) + + fun body(newFloatingTieredWithProrationPrice: Body.NewFloatingTieredWithProrationPrice) = + body(Body.ofNewFloatingTieredWithProrationPrice(newFloatingTieredWithProrationPrice)) + + fun body(newFloatingUnitWithProrationPrice: Body.NewFloatingUnitWithProrationPrice) = + body(Body.ofNewFloatingUnitWithProrationPrice(newFloatingUnitWithProrationPrice)) + + fun body(newFloatingGroupedAllocationPrice: Body.NewFloatingGroupedAllocationPrice) = + body(Body.ofNewFloatingGroupedAllocationPrice(newFloatingGroupedAllocationPrice)) + + fun body( + newFloatingGroupedWithProratedMinimumPrice: + Body.NewFloatingGroupedWithProratedMinimumPrice + ) = + body( + Body.ofNewFloatingGroupedWithProratedMinimumPrice( + newFloatingGroupedWithProratedMinimumPrice + ) + ) + + fun body( + newFloatingGroupedWithMeteredMinimumPrice: + Body.NewFloatingGroupedWithMeteredMinimumPrice + ) = + body( + Body.ofNewFloatingGroupedWithMeteredMinimumPrice( + newFloatingGroupedWithMeteredMinimumPrice + ) + ) + + fun body( + newFloatingMatrixWithDisplayNamePrice: Body.NewFloatingMatrixWithDisplayNamePrice + ) = + body( + Body.ofNewFloatingMatrixWithDisplayNamePrice(newFloatingMatrixWithDisplayNamePrice) + ) + + fun body(newFloatingBulkWithProrationPrice: Body.NewFloatingBulkWithProrationPrice) = + body(Body.ofNewFloatingBulkWithProrationPrice(newFloatingBulkWithProrationPrice)) + + fun body(newFloatingGroupedTieredPackagePrice: Body.NewFloatingGroupedTieredPackagePrice) = + body(Body.ofNewFloatingGroupedTieredPackagePrice(newFloatingGroupedTieredPackagePrice)) + + fun body( + newFloatingScalableMatrixWithUnitPricingPrice: + Body.NewFloatingScalableMatrixWithUnitPricingPrice + ) = + body( + Body.ofNewFloatingScalableMatrixWithUnitPricingPrice( + newFloatingScalableMatrixWithUnitPricingPrice + ) + ) + + fun body( + newFloatingScalableMatrixWithTieredPricingPrice: + Body.NewFloatingScalableMatrixWithTieredPricingPrice + ) = + body( + Body.ofNewFloatingScalableMatrixWithTieredPricingPrice( + newFloatingScalableMatrixWithTieredPricingPrice + ) + ) + + fun body( + newFloatingCumulativeGroupedBulkPrice: Body.NewFloatingCumulativeGroupedBulkPrice + ) = + body( + Body.ofNewFloatingCumulativeGroupedBulkPrice(newFloatingCumulativeGroupedBulkPrice) + ) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) } - 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 */ + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, cumulativeGroupedBulkConfig, currency, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } - /* spotless:on */ + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - override fun hashCode(): Int = hashCode + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } - 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}" + fun build(): PriceCreateParams = + PriceCreateParams( + checkRequired("body", body), + additionalHeaders.build(), + additionalQueryParams.build(), + ) } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt index af33f1bd..4d9a0f0d 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 @@ -43,7 +43,7 @@ import java.util.Optional class PriceEvaluateParams private constructor( private val priceId: String, - private val body: PriceEvaluateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -104,7 +104,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): PriceEvaluateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -118,9 +118,9 @@ private constructor( } @NoAutoDetect - class PriceEvaluateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("timeframe_end") @ExcludeMissing private val timeframeEnd: JsonField = JsonMissing.of(), @@ -212,7 +212,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PriceEvaluateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -233,7 +233,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PriceEvaluateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var timeframeEnd: JsonField? = null @@ -245,14 +245,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(priceEvaluateBody: PriceEvaluateBody) = apply { - timeframeEnd = priceEvaluateBody.timeframeEnd - timeframeStart = priceEvaluateBody.timeframeStart - customerId = priceEvaluateBody.customerId - externalCustomerId = priceEvaluateBody.externalCustomerId - filter = priceEvaluateBody.filter - groupingKeys = priceEvaluateBody.groupingKeys.map { it.toMutableList() } - additionalProperties = priceEvaluateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + timeframeEnd = body.timeframeEnd + timeframeStart = body.timeframeStart + customerId = body.customerId + externalCustomerId = body.externalCustomerId + filter = body.filter + groupingKeys = body.groupingKeys.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() } /** The exclusive upper bound for event timestamps */ @@ -366,8 +366,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): PriceEvaluateBody = - PriceEvaluateBody( + fun build(): Body = + Body( checkRequired("timeframeEnd", timeframeEnd), checkRequired("timeframeStart", timeframeStart), customerId, @@ -383,7 +383,7 @@ private constructor( return true } - return /* spotless:off */ other is PriceEvaluateBody && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && customerId == other.customerId && externalCustomerId == other.externalCustomerId && filter == other.filter && groupingKeys == other.groupingKeys && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && customerId == other.customerId && externalCustomerId == other.externalCustomerId && filter == other.filter && groupingKeys == other.groupingKeys && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -393,7 +393,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PriceEvaluateBody{timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, customerId=$customerId, externalCustomerId=$externalCustomerId, filter=$filter, groupingKeys=$groupingKeys, additionalProperties=$additionalProperties}" + "Body{timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, customerId=$customerId, externalCustomerId=$externalCustomerId, filter=$filter, groupingKeys=$groupingKeys, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -408,7 +408,7 @@ private constructor( class Builder internal constructor() { private var priceId: String? = null - private var body: PriceEvaluateBody.Builder = PriceEvaluateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateResponse.kt index 3f3d5702..15d089db 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateResponse.kt @@ -105,7 +105,7 @@ private constructor( fun build(): PriceEvaluateResponse = PriceEvaluateResponse( checkRequired("data", data).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } 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 05cab5d3..350357d4 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 @@ -27,7 +27,7 @@ import java.util.Optional class PriceExternalPriceIdUpdateParams private constructor( private val externalPriceId: String, - private val body: PriceExternalPriceIdUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -54,7 +54,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): PriceExternalPriceIdUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -68,9 +68,9 @@ private constructor( } @NoAutoDetect - class PriceExternalPriceIdUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("metadata") @ExcludeMissing private val metadata: JsonField = JsonMissing.of(), @@ -98,7 +98,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PriceExternalPriceIdUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -114,19 +114,17 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PriceExternalPriceIdUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(priceExternalPriceIdUpdateBody: PriceExternalPriceIdUpdateBody) = - apply { - metadata = priceExternalPriceIdUpdateBody.metadata - additionalProperties = - priceExternalPriceIdUpdateBody.additionalProperties.toMutableMap() - } + internal fun from(body: Body) = apply { + metadata = body.metadata + additionalProperties = body.additionalProperties.toMutableMap() + } /** * User-specified key/value pairs for the resource. Individual keys can be removed by @@ -168,8 +166,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): PriceExternalPriceIdUpdateBody = - PriceExternalPriceIdUpdateBody(metadata, additionalProperties.toImmutable()) + fun build(): Body = Body(metadata, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -177,7 +174,7 @@ private constructor( return true } - return /* spotless:off */ other is PriceExternalPriceIdUpdateBody && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -187,7 +184,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PriceExternalPriceIdUpdateBody{metadata=$metadata, additionalProperties=$additionalProperties}" + "Body{metadata=$metadata, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -202,8 +199,7 @@ private constructor( class Builder internal constructor() { private var externalPriceId: String? = null - private var body: PriceExternalPriceIdUpdateBody.Builder = - PriceExternalPriceIdUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -378,7 +374,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 e0fecf33..35c604ef 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 @@ -80,11 +80,7 @@ private constructor( @JvmStatic fun of(pricesService: PriceService, params: PriceListParams, response: Response) = - PriceListPage( - pricesService, - params, - response, - ) + PriceListPage(pricesService, params, response) } @NoAutoDetect @@ -174,18 +170,11 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: PriceListPage, - ) : Iterable { + class AutoPager(private val firstPage: PriceListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 0f7b0454..94335c1e 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 @@ -83,11 +83,7 @@ private constructor( @JvmStatic fun of(pricesService: PriceServiceAsync, params: PriceListParams, response: Response) = - PriceListPageAsync( - pricesService, - params, - response, - ) + PriceListPageAsync(pricesService, params, response) } @NoAutoDetect @@ -177,23 +173,16 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: PriceListPageAsync, - ) { + class AutoPager(private val firstPage: PriceListPageAsync) { fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( action: (Price) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -202,7 +191,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt index 8a79cde0..912e1cb3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt @@ -189,12 +189,7 @@ private constructor( } fun build(): PriceListParams = - PriceListParams( - cursor, - limit, - additionalHeaders.build(), - additionalQueryParams.build(), - ) + PriceListParams(cursor, limit, additionalHeaders.build(), additionalQueryParams.build()) } override fun equals(other: Any?): Boolean { 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 4a895755..1a34b10c 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 @@ -27,7 +27,7 @@ import java.util.Optional class PriceUpdateParams private constructor( private val priceId: String, - private val body: PriceUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -54,7 +54,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): PriceUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -68,9 +68,9 @@ private constructor( } @NoAutoDetect - class PriceUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("metadata") @ExcludeMissing private val metadata: JsonField = JsonMissing.of(), @@ -98,7 +98,7 @@ private constructor( private var validated: Boolean = false - fun validate(): PriceUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -114,16 +114,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PriceUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(priceUpdateBody: PriceUpdateBody) = apply { - metadata = priceUpdateBody.metadata - additionalProperties = priceUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + metadata = body.metadata + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -166,8 +166,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): PriceUpdateBody = - PriceUpdateBody(metadata, additionalProperties.toImmutable()) + fun build(): Body = Body(metadata, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -175,7 +174,7 @@ private constructor( return true } - return /* spotless:off */ other is PriceUpdateBody && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -185,7 +184,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PriceUpdateBody{metadata=$metadata, additionalProperties=$additionalProperties}" + "Body{metadata=$metadata, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -200,7 +199,7 @@ private constructor( class Builder internal constructor() { private var priceId: String? = null - private var body: PriceUpdateBody.Builder = PriceUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -371,7 +370,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 90173952..15793edd 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 @@ -1418,7 +1418,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1429,7 +1429,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1440,14 +1440,14 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Adjustment( planPhasePercentageDiscount = it, - _json = json + _json = json, ) } } @@ -1478,7 +1478,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.planPhaseUsageDiscount != null -> @@ -1776,9 +1776,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1800,7 +1798,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -2163,9 +2161,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2187,7 +2183,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2553,9 +2549,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2577,7 +2571,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2958,9 +2952,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2982,7 +2974,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3344,9 +3336,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3368,7 +3358,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3843,7 +3833,7 @@ private constructor( override fun serialize( value: DiscountInterval, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.amount != null -> generator.writeObject(value.amount) @@ -4103,9 +4093,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4126,7 +4114,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** @@ -4463,9 +4451,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4486,7 +4472,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -4828,9 +4814,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4851,7 +4835,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** @@ -5344,7 +5328,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6791,11 +6775,7 @@ private constructor( "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 53f8662c..5035b996 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 @@ -77,7 +77,7 @@ import java.util.Optional class SubscriptionCancelParams private constructor( private val subscriptionId: String, - private val body: SubscriptionCancelBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -122,7 +122,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SubscriptionCancelBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -136,9 +136,9 @@ private constructor( } @NoAutoDetect - class SubscriptionCancelBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("cancel_option") @ExcludeMissing private val cancelOption: JsonField = JsonMissing.of(), @@ -200,7 +200,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SubscriptionCancelBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -218,7 +218,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SubscriptionCancelBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var cancelOption: JsonField? = null @@ -227,11 +227,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(subscriptionCancelBody: SubscriptionCancelBody) = apply { - cancelOption = subscriptionCancelBody.cancelOption - allowInvoiceCreditOrVoid = subscriptionCancelBody.allowInvoiceCreditOrVoid - cancellationDate = subscriptionCancelBody.cancellationDate - additionalProperties = subscriptionCancelBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + cancelOption = body.cancelOption + allowInvoiceCreditOrVoid = body.allowInvoiceCreditOrVoid + cancellationDate = body.cancellationDate + additionalProperties = body.additionalProperties.toMutableMap() } /** Determines the timing of subscription cancellation */ @@ -317,8 +317,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SubscriptionCancelBody = - SubscriptionCancelBody( + fun build(): Body = + Body( checkRequired("cancelOption", cancelOption), allowInvoiceCreditOrVoid, cancellationDate, @@ -331,7 +331,7 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionCancelBody && cancelOption == other.cancelOption && allowInvoiceCreditOrVoid == other.allowInvoiceCreditOrVoid && cancellationDate == other.cancellationDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && cancelOption == other.cancelOption && allowInvoiceCreditOrVoid == other.allowInvoiceCreditOrVoid && cancellationDate == other.cancellationDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -341,7 +341,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionCancelBody{cancelOption=$cancelOption, allowInvoiceCreditOrVoid=$allowInvoiceCreditOrVoid, cancellationDate=$cancellationDate, additionalProperties=$additionalProperties}" + "Body{cancelOption=$cancelOption, allowInvoiceCreditOrVoid=$allowInvoiceCreditOrVoid, cancellationDate=$cancellationDate, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -356,7 +356,7 @@ private constructor( class Builder internal constructor() { private var subscriptionId: String? = null - private var body: SubscriptionCancelBody.Builder = SubscriptionCancelBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -563,11 +563,8 @@ private constructor( } /** Determines the timing of subscription cancellation */ - class CancelOption - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class CancelOption @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. 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 84e16554..29345789 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 @@ -1406,7 +1406,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1417,7 +1417,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1428,14 +1428,14 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Adjustment( planPhasePercentageDiscount = it, - _json = json + _json = json, ) } } @@ -1466,7 +1466,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.planPhaseUsageDiscount != null -> @@ -1764,9 +1764,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1788,7 +1786,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -2151,9 +2149,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2175,7 +2171,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2541,9 +2537,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2565,7 +2559,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2946,9 +2940,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2970,7 +2962,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3332,9 +3324,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3356,7 +3346,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3831,7 +3821,7 @@ private constructor( override fun serialize( value: DiscountInterval, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.amount != null -> generator.writeObject(value.amount) @@ -4091,9 +4081,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4114,7 +4102,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** @@ -4451,9 +4439,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4474,7 +4460,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -4816,9 +4802,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4839,7 +4823,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** @@ -5332,7 +5316,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6779,11 +6763,7 @@ private constructor( "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 be21928e..c7022a6a 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 @@ -268,7 +268,7 @@ import kotlin.jvm.optionals.getOrNull */ class SubscriptionCreateParams private constructor( - private val body: SubscriptionCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -565,16 +565,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SubscriptionCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class SubscriptionCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("add_adjustments") @ExcludeMissing private val addAdjustments: JsonField> = JsonMissing.of(), @@ -1047,7 +1047,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SubscriptionCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -1092,7 +1092,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SubscriptionCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var addAdjustments: JsonField>? = null @@ -1130,43 +1130,38 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(subscriptionCreateBody: SubscriptionCreateBody) = apply { - addAdjustments = subscriptionCreateBody.addAdjustments.map { it.toMutableList() } - addPrices = subscriptionCreateBody.addPrices.map { it.toMutableList() } - alignBillingWithSubscriptionStartDate = - subscriptionCreateBody.alignBillingWithSubscriptionStartDate - autoCollection = subscriptionCreateBody.autoCollection - awsRegion = subscriptionCreateBody.awsRegion - billingCycleAnchorConfiguration = - subscriptionCreateBody.billingCycleAnchorConfiguration - couponRedemptionCode = subscriptionCreateBody.couponRedemptionCode - creditsOverageRate = subscriptionCreateBody.creditsOverageRate - customerId = subscriptionCreateBody.customerId - defaultInvoiceMemo = subscriptionCreateBody.defaultInvoiceMemo - endDate = subscriptionCreateBody.endDate - externalCustomerId = subscriptionCreateBody.externalCustomerId - externalMarketplace = subscriptionCreateBody.externalMarketplace - externalMarketplaceReportingId = - subscriptionCreateBody.externalMarketplaceReportingId - externalPlanId = subscriptionCreateBody.externalPlanId - filter = subscriptionCreateBody.filter - initialPhaseOrder = subscriptionCreateBody.initialPhaseOrder - invoicingThreshold = subscriptionCreateBody.invoicingThreshold - metadata = subscriptionCreateBody.metadata - netTerms = subscriptionCreateBody.netTerms - perCreditOverageAmount = subscriptionCreateBody.perCreditOverageAmount - planId = subscriptionCreateBody.planId - planVersionNumber = subscriptionCreateBody.planVersionNumber - priceOverrides = subscriptionCreateBody.priceOverrides.map { it.toMutableList() } - removeAdjustments = - subscriptionCreateBody.removeAdjustments.map { it.toMutableList() } - removePrices = subscriptionCreateBody.removePrices.map { it.toMutableList() } - replaceAdjustments = - subscriptionCreateBody.replaceAdjustments.map { it.toMutableList() } - replacePrices = subscriptionCreateBody.replacePrices.map { it.toMutableList() } - startDate = subscriptionCreateBody.startDate - trialDurationDays = subscriptionCreateBody.trialDurationDays - additionalProperties = subscriptionCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + addAdjustments = body.addAdjustments.map { it.toMutableList() } + addPrices = body.addPrices.map { it.toMutableList() } + alignBillingWithSubscriptionStartDate = body.alignBillingWithSubscriptionStartDate + autoCollection = body.autoCollection + awsRegion = body.awsRegion + billingCycleAnchorConfiguration = body.billingCycleAnchorConfiguration + couponRedemptionCode = body.couponRedemptionCode + creditsOverageRate = body.creditsOverageRate + customerId = body.customerId + defaultInvoiceMemo = body.defaultInvoiceMemo + endDate = body.endDate + externalCustomerId = body.externalCustomerId + externalMarketplace = body.externalMarketplace + externalMarketplaceReportingId = body.externalMarketplaceReportingId + externalPlanId = body.externalPlanId + filter = body.filter + initialPhaseOrder = body.initialPhaseOrder + invoicingThreshold = body.invoicingThreshold + metadata = body.metadata + netTerms = body.netTerms + perCreditOverageAmount = body.perCreditOverageAmount + planId = body.planId + planVersionNumber = body.planVersionNumber + priceOverrides = body.priceOverrides.map { it.toMutableList() } + removeAdjustments = body.removeAdjustments.map { it.toMutableList() } + removePrices = body.removePrices.map { it.toMutableList() } + replaceAdjustments = body.replaceAdjustments.map { it.toMutableList() } + replacePrices = body.replacePrices.map { it.toMutableList() } + startDate = body.startDate + trialDurationDays = body.trialDurationDays + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -1875,8 +1870,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SubscriptionCreateBody = - SubscriptionCreateBody( + fun build(): Body = + Body( (addAdjustments ?: JsonMissing.of()).map { it.toImmutable() }, (addPrices ?: JsonMissing.of()).map { it.toImmutable() }, alignBillingWithSubscriptionStartDate, @@ -1916,7 +1911,7 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionCreateBody && addAdjustments == other.addAdjustments && addPrices == other.addPrices && alignBillingWithSubscriptionStartDate == other.alignBillingWithSubscriptionStartDate && autoCollection == other.autoCollection && awsRegion == other.awsRegion && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && couponRedemptionCode == other.couponRedemptionCode && creditsOverageRate == other.creditsOverageRate && customerId == other.customerId && defaultInvoiceMemo == other.defaultInvoiceMemo && endDate == other.endDate && externalCustomerId == other.externalCustomerId && externalMarketplace == other.externalMarketplace && externalMarketplaceReportingId == other.externalMarketplaceReportingId && externalPlanId == other.externalPlanId && filter == other.filter && initialPhaseOrder == other.initialPhaseOrder && invoicingThreshold == other.invoicingThreshold && metadata == other.metadata && netTerms == other.netTerms && perCreditOverageAmount == other.perCreditOverageAmount && planId == other.planId && planVersionNumber == other.planVersionNumber && priceOverrides == other.priceOverrides && removeAdjustments == other.removeAdjustments && removePrices == other.removePrices && replaceAdjustments == other.replaceAdjustments && replacePrices == other.replacePrices && startDate == other.startDate && trialDurationDays == other.trialDurationDays && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && addAdjustments == other.addAdjustments && addPrices == other.addPrices && alignBillingWithSubscriptionStartDate == other.alignBillingWithSubscriptionStartDate && autoCollection == other.autoCollection && awsRegion == other.awsRegion && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && couponRedemptionCode == other.couponRedemptionCode && creditsOverageRate == other.creditsOverageRate && customerId == other.customerId && defaultInvoiceMemo == other.defaultInvoiceMemo && endDate == other.endDate && externalCustomerId == other.externalCustomerId && externalMarketplace == other.externalMarketplace && externalMarketplaceReportingId == other.externalMarketplaceReportingId && externalPlanId == other.externalPlanId && filter == other.filter && initialPhaseOrder == other.initialPhaseOrder && invoicingThreshold == other.invoicingThreshold && metadata == other.metadata && netTerms == other.netTerms && perCreditOverageAmount == other.perCreditOverageAmount && planId == other.planId && planVersionNumber == other.planVersionNumber && priceOverrides == other.priceOverrides && removeAdjustments == other.removeAdjustments && removePrices == other.removePrices && replaceAdjustments == other.replaceAdjustments && replacePrices == other.replacePrices && startDate == other.startDate && trialDurationDays == other.trialDurationDays && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1926,7 +1921,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionCreateBody{addAdjustments=$addAdjustments, addPrices=$addPrices, alignBillingWithSubscriptionStartDate=$alignBillingWithSubscriptionStartDate, autoCollection=$autoCollection, awsRegion=$awsRegion, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, couponRedemptionCode=$couponRedemptionCode, creditsOverageRate=$creditsOverageRate, customerId=$customerId, defaultInvoiceMemo=$defaultInvoiceMemo, endDate=$endDate, externalCustomerId=$externalCustomerId, externalMarketplace=$externalMarketplace, externalMarketplaceReportingId=$externalMarketplaceReportingId, externalPlanId=$externalPlanId, filter=$filter, initialPhaseOrder=$initialPhaseOrder, invoicingThreshold=$invoicingThreshold, metadata=$metadata, netTerms=$netTerms, perCreditOverageAmount=$perCreditOverageAmount, planId=$planId, planVersionNumber=$planVersionNumber, priceOverrides=$priceOverrides, removeAdjustments=$removeAdjustments, removePrices=$removePrices, replaceAdjustments=$replaceAdjustments, replacePrices=$replacePrices, startDate=$startDate, trialDurationDays=$trialDurationDays, additionalProperties=$additionalProperties}" + "Body{addAdjustments=$addAdjustments, addPrices=$addPrices, alignBillingWithSubscriptionStartDate=$alignBillingWithSubscriptionStartDate, autoCollection=$autoCollection, awsRegion=$awsRegion, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, couponRedemptionCode=$couponRedemptionCode, creditsOverageRate=$creditsOverageRate, customerId=$customerId, defaultInvoiceMemo=$defaultInvoiceMemo, endDate=$endDate, externalCustomerId=$externalCustomerId, externalMarketplace=$externalMarketplace, externalMarketplaceReportingId=$externalMarketplaceReportingId, externalPlanId=$externalPlanId, filter=$filter, initialPhaseOrder=$initialPhaseOrder, invoicingThreshold=$invoicingThreshold, metadata=$metadata, netTerms=$netTerms, perCreditOverageAmount=$perCreditOverageAmount, planId=$planId, planVersionNumber=$planVersionNumber, priceOverrides=$priceOverrides, removeAdjustments=$removeAdjustments, removePrices=$removePrices, replaceAdjustments=$replaceAdjustments, replacePrices=$replacePrices, startDate=$startDate, trialDurationDays=$trialDurationDays, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -1940,7 +1935,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: SubscriptionCreateBody.Builder = SubscriptionCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -3156,7 +3151,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newPercentageDiscount != null -> @@ -3363,9 +3358,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3387,7 +3380,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -3659,9 +3652,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3683,7 +3674,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -3955,9 +3946,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3979,7 +3968,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -4269,9 +4258,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4293,7 +4280,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -4564,9 +4551,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4588,7 +4573,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -5410,11 +5395,8 @@ private constructor( } /** The cadence at which to allocate the amount to the customer. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5766,9 +5748,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -6574,21 +6554,21 @@ private constructor( "threshold_total_amount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionThresholdTotalAmount = it, - _json = json + _json = json, ) } } "tiered_package" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -6599,21 +6579,21 @@ private constructor( "tiered_with_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionTieredWithMinimum = it, - _json = json + _json = json, ) } } "unit_with_percent" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -6624,84 +6604,84 @@ private constructor( "package_with_allocation" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionPackageWithAllocation = it, - _json = json + _json = json, ) } } "tiered_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionTierWithProration = it, - _json = json + _json = json, ) } } "unit_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionUnitWithProration = it, - _json = json + _json = json, ) } } "grouped_allocation" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionGroupedAllocation = it, - _json = json + _json = json, ) } } "grouped_with_prorated_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionGroupedWithProratedMinimum = it, - _json = json + _json = json, ) } } "bulk_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionBulkWithProration = it, - _json = json + _json = json, ) } } @@ -6716,7 +6696,7 @@ private constructor( override fun serialize( value: Price, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newSubscriptionUnit != null -> @@ -7414,9 +7394,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -7534,9 +7512,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -7558,7 +7534,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT, + UNIT } /** @@ -7710,7 +7686,7 @@ private constructor( fun build(): UnitConfig = UnitConfig( checkRequired("unitAmount", unitAmount), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -7854,9 +7830,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -8092,9 +8066,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -8217,7 +8189,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -8967,9 +8939,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -9087,9 +9057,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -9111,7 +9079,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE, + PACKAGE } /** @@ -9443,9 +9411,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -9681,9 +9647,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -9806,7 +9770,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -10556,9 +10520,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11052,9 +11014,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11076,7 +11036,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MATRIX, + MATRIX } /** @@ -11263,9 +11223,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11501,9 +11459,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11626,7 +11582,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -12376,9 +12332,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -12496,9 +12450,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -12520,7 +12472,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED, + TIERED } /** @@ -12692,7 +12644,7 @@ private constructor( fun build(): TieredConfig = TieredConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -13021,9 +12973,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -13259,9 +13209,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -13384,7 +13332,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -14136,9 +14084,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -14256,9 +14202,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -14280,7 +14224,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_BPS, + TIERED_BPS } /** @@ -14462,7 +14406,7 @@ private constructor( fun build(): TieredBpsConfig = TieredBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -14794,9 +14738,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -15032,9 +14974,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -15157,7 +15097,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -16039,9 +15979,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16159,9 +16097,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16183,7 +16119,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BPS, + BPS } /** @@ -16370,9 +16306,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16608,9 +16542,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16733,7 +16665,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -17596,7 +17528,7 @@ private constructor( fun build(): BulkBpsConfig = BulkBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -17785,9 +17717,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -17905,9 +17835,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -17929,7 +17857,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_BPS, + BULK_BPS } /** @@ -18116,9 +18044,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -18354,9 +18280,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -18479,7 +18403,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -19325,7 +19249,7 @@ private constructor( fun build(): BulkConfig = BulkConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -19497,9 +19421,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -19617,9 +19539,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -19641,7 +19561,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK, + BULK } /** @@ -19828,9 +19748,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -20066,9 +19984,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -20191,7 +20107,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -20952,9 +20868,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21072,9 +20986,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21096,7 +21008,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - THRESHOLD_TOTAL_AMOUNT, + THRESHOLD_TOTAL_AMOUNT } /** @@ -21166,7 +21078,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -21369,9 +21281,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21607,9 +21517,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21732,7 +21640,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -22485,9 +22393,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -22605,9 +22511,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -22629,7 +22533,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_PACKAGE, + TIERED_PACKAGE } /** @@ -22699,7 +22603,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -22901,9 +22805,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -23139,9 +23041,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -23264,7 +23164,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -24022,9 +23922,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24142,9 +24040,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24166,7 +24062,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_MINIMUM, + TIERED_WITH_MINIMUM } /** @@ -24236,7 +24132,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -24439,9 +24335,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24677,9 +24571,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24802,7 +24694,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -25557,9 +25449,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -25677,9 +25567,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -25701,7 +25589,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PERCENT, + UNIT_WITH_PERCENT } /** @@ -25771,7 +25659,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -25973,9 +25861,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -26211,9 +26097,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -26336,7 +26220,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -27082,7 +26966,7 @@ private constructor( checkRequired("name", name), checkRequired( "packageWithAllocationConfig", - packageWithAllocationConfig + packageWithAllocationConfig, ), billableMetricId, billedInAdvance, @@ -27102,9 +26986,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27222,9 +27104,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27246,7 +27126,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE_WITH_ALLOCATION, + PACKAGE_WITH_ALLOCATION } /** @@ -27316,7 +27196,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -27520,9 +27400,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27758,9 +27636,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27883,7 +27759,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -28643,9 +28519,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -28763,9 +28637,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -28787,7 +28659,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_PRORATION, + TIERED_WITH_PRORATION } /** @@ -28857,7 +28729,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -29060,9 +28932,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -29298,9 +29168,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -29423,7 +29291,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -30181,9 +30049,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30301,9 +30167,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30325,7 +30189,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PRORATION, + UNIT_WITH_PRORATION } /** @@ -30395,7 +30259,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -30598,9 +30462,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30836,9 +30698,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30961,7 +30821,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -31719,9 +31579,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -31842,7 +31700,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -31925,9 +31783,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -31949,7 +31805,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_ALLOCATION, + GROUPED_ALLOCATION } /** @@ -32136,9 +31992,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -32374,9 +32228,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -32499,7 +32351,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -33256,7 +33108,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired( "groupedWithProratedMinimumConfig", - groupedWithProratedMinimumConfig + groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), checkRequired("modelType", modelType), @@ -33279,9 +33131,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33402,7 +33252,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -33486,9 +33336,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33511,7 +33359,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_WITH_PRORATED_MINIMUM, + GROUPED_WITH_PRORATED_MINIMUM } /** @@ -33698,9 +33546,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33936,9 +33782,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -34061,7 +33905,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -34821,7 +34665,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -34905,9 +34749,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -35025,9 +34867,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -35049,7 +34889,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_WITH_PRORATION, + BULK_WITH_PRORATION } /** @@ -35236,9 +35076,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -35474,9 +35312,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -35599,7 +35435,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -35923,9 +35759,7 @@ private constructor( @Deprecated("deprecated") class ExternalMarketplace @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -36031,7 +35865,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -36187,7 +36021,7 @@ private constructor( fun build(): RemoveAdjustment = RemoveAdjustment( checkRequired("adjustmentId", adjustmentId), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -36317,11 +36151,7 @@ private constructor( } fun build(): RemovePrice = - RemovePrice( - externalPriceId, - priceId, - additionalProperties.toImmutable(), - ) + RemovePrice(externalPriceId, priceId, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -36701,7 +36531,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newPercentageDiscount != null -> @@ -36908,9 +36738,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -36932,7 +36760,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -37204,9 +37032,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -37228,7 +37054,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -37500,9 +37326,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -37524,7 +37348,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -37814,9 +37638,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -37838,7 +37660,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -38109,9 +37931,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -38133,7 +37953,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -38897,11 +38717,8 @@ private constructor( } /** The cadence at which to allocate the amount to the customer. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -39253,9 +39070,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -40061,21 +39876,21 @@ private constructor( "threshold_total_amount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionThresholdTotalAmount = it, - _json = json + _json = json, ) } } "tiered_package" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -40086,21 +39901,21 @@ private constructor( "tiered_with_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionTieredWithMinimum = it, - _json = json + _json = json, ) } } "unit_with_percent" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -40111,84 +39926,84 @@ private constructor( "package_with_allocation" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionPackageWithAllocation = it, - _json = json + _json = json, ) } } "tiered_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionTierWithProration = it, - _json = json + _json = json, ) } } "unit_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionUnitWithProration = it, - _json = json + _json = json, ) } } "grouped_allocation" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionGroupedAllocation = it, - _json = json + _json = json, ) } } "grouped_with_prorated_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionGroupedWithProratedMinimum = it, - _json = json + _json = json, ) } } "bulk_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionBulkWithProration = it, - _json = json + _json = json, ) } } @@ -40203,7 +40018,7 @@ private constructor( override fun serialize( value: Price, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newSubscriptionUnit != null -> @@ -40901,9 +40716,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -41021,9 +40834,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -41045,7 +40856,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT, + UNIT } /** @@ -41197,7 +41008,7 @@ private constructor( fun build(): UnitConfig = UnitConfig( checkRequired("unitAmount", unitAmount), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -41341,9 +41152,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -41579,9 +41388,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -41704,7 +41511,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -42454,9 +42261,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -42574,9 +42379,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -42598,7 +42401,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE, + PACKAGE } /** @@ -42930,9 +42733,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -43168,9 +42969,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -43293,7 +43092,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -44043,9 +43842,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -44539,9 +44336,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -44563,7 +44358,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MATRIX, + MATRIX } /** @@ -44750,9 +44545,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -44988,9 +44781,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -45113,7 +44904,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -45863,9 +45654,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -45983,9 +45772,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -46007,7 +45794,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED, + TIERED } /** @@ -46179,7 +45966,7 @@ private constructor( fun build(): TieredConfig = TieredConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -46508,9 +46295,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -46746,9 +46531,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -46871,7 +46654,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -47623,9 +47406,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -47743,9 +47524,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -47767,7 +47546,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_BPS, + TIERED_BPS } /** @@ -47949,7 +47728,7 @@ private constructor( fun build(): TieredBpsConfig = TieredBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -48281,9 +48060,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -48519,9 +48296,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -48644,7 +48419,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -49526,9 +49301,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -49646,9 +49419,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -49670,7 +49441,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BPS, + BPS } /** @@ -49857,9 +49628,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -50095,9 +49864,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -50220,7 +49987,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -51083,7 +50850,7 @@ private constructor( fun build(): BulkBpsConfig = BulkBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -51272,9 +51039,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -51392,9 +51157,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -51416,7 +51179,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_BPS, + BULK_BPS } /** @@ -51603,9 +51366,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -51841,9 +51602,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -51966,7 +51725,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -52812,7 +52571,7 @@ private constructor( fun build(): BulkConfig = BulkConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -52984,9 +52743,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -53104,9 +52861,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -53128,7 +52883,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK, + BULK } /** @@ -53315,9 +53070,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -53553,9 +53306,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -53678,7 +53429,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -54439,9 +54190,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -54559,9 +54308,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -54583,7 +54330,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - THRESHOLD_TOTAL_AMOUNT, + THRESHOLD_TOTAL_AMOUNT } /** @@ -54653,7 +54400,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -54856,9 +54603,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -55094,9 +54839,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -55219,7 +54962,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -55972,9 +55715,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -56092,9 +55833,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -56116,7 +55855,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_PACKAGE, + TIERED_PACKAGE } /** @@ -56186,7 +55925,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -56388,9 +56127,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -56626,9 +56363,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -56751,7 +56486,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -57509,9 +57244,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -57629,9 +57362,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -57653,7 +57384,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_MINIMUM, + TIERED_WITH_MINIMUM } /** @@ -57723,7 +57454,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -57926,9 +57657,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -58164,9 +57893,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -58289,7 +58016,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -59044,9 +58771,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -59164,9 +58889,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -59188,7 +58911,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PERCENT, + UNIT_WITH_PERCENT } /** @@ -59258,7 +58981,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -59460,9 +59183,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -59698,9 +59419,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -59823,7 +59542,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -60569,7 +60288,7 @@ private constructor( checkRequired("name", name), checkRequired( "packageWithAllocationConfig", - packageWithAllocationConfig + packageWithAllocationConfig, ), billableMetricId, billedInAdvance, @@ -60589,9 +60308,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -60709,9 +60426,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -60733,7 +60448,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE_WITH_ALLOCATION, + PACKAGE_WITH_ALLOCATION } /** @@ -60803,7 +60518,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -61007,9 +60722,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -61245,9 +60958,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -61370,7 +61081,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -62130,9 +61841,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -62250,9 +61959,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -62274,7 +61981,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_PRORATION, + TIERED_WITH_PRORATION } /** @@ -62344,7 +62051,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -62547,9 +62254,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -62785,9 +62490,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -62910,7 +62613,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -63668,9 +63371,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -63788,9 +63489,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -63812,7 +63511,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PRORATION, + UNIT_WITH_PRORATION } /** @@ -63882,7 +63581,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -64085,9 +63784,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -64323,9 +64020,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -64448,7 +64143,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -65206,9 +64901,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -65329,7 +65022,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -65412,9 +65105,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -65436,7 +65127,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_ALLOCATION, + GROUPED_ALLOCATION } /** @@ -65623,9 +65314,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -65861,9 +65550,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -65986,7 +65673,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -66743,7 +66430,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired( "groupedWithProratedMinimumConfig", - groupedWithProratedMinimumConfig + groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), checkRequired("modelType", modelType), @@ -66766,9 +66453,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -66889,7 +66574,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -66973,9 +66658,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -66998,7 +66681,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_WITH_PRORATED_MINIMUM, + GROUPED_WITH_PRORATED_MINIMUM } /** @@ -67185,9 +66868,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -67423,9 +67104,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -67548,7 +67227,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -68308,7 +67987,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -68392,9 +68071,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -68512,9 +68189,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -68536,7 +68211,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_WITH_PRORATION, + BULK_WITH_PRORATION } /** @@ -68723,9 +68398,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -68961,9 +68634,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -69086,7 +68757,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 c251b8e1..72ad3443 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 @@ -1406,7 +1406,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1417,7 +1417,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1428,14 +1428,14 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Adjustment( planPhasePercentageDiscount = it, - _json = json + _json = json, ) } } @@ -1466,7 +1466,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.planPhaseUsageDiscount != null -> @@ -1764,9 +1764,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1788,7 +1786,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -2151,9 +2149,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2175,7 +2171,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2541,9 +2537,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2565,7 +2559,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2946,9 +2940,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2970,7 +2962,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3332,9 +3324,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3356,7 +3346,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3831,7 +3821,7 @@ private constructor( override fun serialize( value: DiscountInterval, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.amount != null -> generator.writeObject(value.amount) @@ -4091,9 +4081,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4114,7 +4102,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** @@ -4451,9 +4439,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4474,7 +4460,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -4816,9 +4802,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4839,7 +4823,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** @@ -5332,7 +5316,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6779,11 +6763,7 @@ private constructor( "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 46601a0a..a144e237 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 @@ -68,13 +68,13 @@ private constructor( this.timeframeEnd?.let { queryParams.put( "timeframe_end", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.timeframeStart?.let { queryParams.put( "timeframe_start", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.viewMode?.let { queryParams.put("view_mode", listOf(it.toString())) } @@ -272,11 +272,7 @@ private constructor( * incremental day-by-day costs. If your customer has minimums or discounts, it's strongly * recommended that you use the default cumulative behavior. */ - class ViewMode - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ViewMode @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 778c280e..34865071 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 @@ -108,7 +108,7 @@ private constructor( fun build(): SubscriptionFetchCostsResponse = SubscriptionFetchCostsResponse( checkRequired("data", data).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } 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 267521bc..1240b084 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 @@ -83,13 +83,8 @@ private constructor( fun of( subscriptionsService: SubscriptionService, params: SubscriptionFetchScheduleParams, - response: Response - ) = - SubscriptionFetchSchedulePage( - subscriptionsService, - params, - response, - ) + response: Response, + ) = SubscriptionFetchSchedulePage(subscriptionsService, params, response) } @NoAutoDetect @@ -183,18 +178,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: SubscriptionFetchSchedulePage, - ) : Iterable { + class AutoPager(private val firstPage: SubscriptionFetchSchedulePage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 f44351ed..7900afaa 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 @@ -86,13 +86,8 @@ private constructor( fun of( subscriptionsService: SubscriptionServiceAsync, params: SubscriptionFetchScheduleParams, - response: Response - ) = - SubscriptionFetchSchedulePageAsync( - subscriptionsService, - params, - response, - ) + response: Response, + ) = SubscriptionFetchSchedulePageAsync(subscriptionsService, params, response) } @NoAutoDetect @@ -186,26 +181,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: SubscriptionFetchSchedulePageAsync, - ) { + class AutoPager(private val firstPage: SubscriptionFetchSchedulePageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (SubscriptionFetchScheduleResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -214,7 +202,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 aa331206..5db99de4 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 @@ -62,25 +62,25 @@ private constructor( this.startDateGt?.let { queryParams.put( "start_date[gt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.startDateGte?.let { queryParams.put( "start_date[gte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.startDateLt?.let { queryParams.put( "start_date[lt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.startDateLte?.let { queryParams.put( "start_date[lte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } queryParams.putAll(additionalQueryParams) 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 f67d49ad..0ffd03cb 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 @@ -271,13 +271,13 @@ private constructor( this.timeframeEnd?.let { queryParams.put( "timeframe_end", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.timeframeStart?.let { queryParams.put( "timeframe_start", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.viewMode?.let { queryParams.put("view_mode", listOf(it.toString())) } @@ -540,11 +540,8 @@ private constructor( } /** This determines the windowing of usage reporting. */ - class Granularity - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Granularity @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -565,7 +562,7 @@ private constructor( /** An enum containing [Granularity]'s known values. */ enum class Known { - DAY, + DAY } /** @@ -632,11 +629,7 @@ private constructor( * incremental day-by-day usage. If your customer has minimums or discounts, it's strongly * recommended that you use the default cumulative behavior. */ - class ViewMode - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ViewMode @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 3110f38d..75ddfb25 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 @@ -88,13 +88,8 @@ private constructor( fun of( subscriptionsService: SubscriptionService, params: SubscriptionListParams, - response: Response - ) = - SubscriptionListPage( - subscriptionsService, - params, - response, - ) + response: Response, + ) = SubscriptionListPage(subscriptionsService, params, response) } @NoAutoDetect @@ -184,18 +179,11 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: SubscriptionListPage, - ) : Iterable { + class AutoPager(private val firstPage: SubscriptionListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 683bd73a..9aedec60 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 @@ -91,13 +91,8 @@ private constructor( fun of( subscriptionsService: SubscriptionServiceAsync, params: SubscriptionListParams, - response: Response - ) = - SubscriptionListPageAsync( - subscriptionsService, - params, - response, - ) + response: Response, + ) = SubscriptionListPageAsync(subscriptionsService, params, response) } @NoAutoDetect @@ -187,23 +182,16 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paginationMetadata, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: SubscriptionListPageAsync, - ) { + class AutoPager(private val firstPage: SubscriptionListPageAsync) { fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( action: (Subscription) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -212,7 +200,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt index 649c4277..15183e5f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt @@ -75,25 +75,25 @@ private constructor( this.createdAtGt?.let { queryParams.put( "created_at[gt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtGte?.let { queryParams.put( "created_at[gte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLt?.let { queryParams.put( "created_at[lt]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.createdAtLte?.let { queryParams.put( "created_at[lte]", - listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), ) } this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) } @@ -322,11 +322,7 @@ private constructor( ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 7d5144dd..e82a7e88 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,7 +102,7 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionPriceIntervalsParams private constructor( private val subscriptionId: String, - private val body: SubscriptionPriceIntervalsBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -153,7 +153,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SubscriptionPriceIntervalsBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -167,9 +167,9 @@ private constructor( } @NoAutoDetect - class SubscriptionPriceIntervalsBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("add") @ExcludeMissing private val add: JsonField> = JsonMissing.of(), @@ -244,7 +244,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SubscriptionPriceIntervalsBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -264,7 +264,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SubscriptionPriceIntervalsBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var add: JsonField>? = null @@ -275,19 +275,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(subscriptionPriceIntervalsBody: SubscriptionPriceIntervalsBody) = - apply { - add = subscriptionPriceIntervalsBody.add.map { it.toMutableList() } - addAdjustments = - subscriptionPriceIntervalsBody.addAdjustments.map { it.toMutableList() } - allowInvoiceCreditOrVoid = - subscriptionPriceIntervalsBody.allowInvoiceCreditOrVoid - edit = subscriptionPriceIntervalsBody.edit.map { it.toMutableList() } - editAdjustments = - subscriptionPriceIntervalsBody.editAdjustments.map { it.toMutableList() } - additionalProperties = - subscriptionPriceIntervalsBody.additionalProperties.toMutableMap() - } + internal fun from(body: Body) = apply { + add = body.add.map { it.toMutableList() } + addAdjustments = body.addAdjustments.map { it.toMutableList() } + allowInvoiceCreditOrVoid = body.allowInvoiceCreditOrVoid + edit = body.edit.map { it.toMutableList() } + editAdjustments = body.editAdjustments.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } /** A list of price intervals to add to the subscription. */ fun add(add: List) = add(JsonField.of(add)) @@ -430,8 +425,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SubscriptionPriceIntervalsBody = - SubscriptionPriceIntervalsBody( + fun build(): Body = + Body( (add ?: JsonMissing.of()).map { it.toImmutable() }, (addAdjustments ?: JsonMissing.of()).map { it.toImmutable() }, allowInvoiceCreditOrVoid, @@ -446,7 +441,7 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionPriceIntervalsBody && add == other.add && addAdjustments == other.addAdjustments && allowInvoiceCreditOrVoid == other.allowInvoiceCreditOrVoid && edit == other.edit && editAdjustments == other.editAdjustments && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && add == other.add && addAdjustments == other.addAdjustments && allowInvoiceCreditOrVoid == other.allowInvoiceCreditOrVoid && edit == other.edit && editAdjustments == other.editAdjustments && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -456,7 +451,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionPriceIntervalsBody{add=$add, addAdjustments=$addAdjustments, allowInvoiceCreditOrVoid=$allowInvoiceCreditOrVoid, edit=$edit, editAdjustments=$editAdjustments, additionalProperties=$additionalProperties}" + "Body{add=$add, addAdjustments=$addAdjustments, allowInvoiceCreditOrVoid=$allowInvoiceCreditOrVoid, edit=$edit, editAdjustments=$editAdjustments, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -471,8 +466,7 @@ private constructor( class Builder internal constructor() { private var subscriptionId: String? = null - private var body: SubscriptionPriceIntervalsBody.Builder = - SubscriptionPriceIntervalsBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -1496,7 +1490,7 @@ private constructor( override fun serialize( value: StartDate, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.dateTime != null -> generator.writeObject(value.dateTime) @@ -1688,11 +1682,8 @@ private constructor( } /** The cadence at which to allocate the amount to the customer. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1999,14 +1990,14 @@ private constructor( "percentage" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Discount( percentageDiscountCreationParams = it, - _json = json + _json = json, ) } } @@ -2029,7 +2020,7 @@ private constructor( override fun serialize( value: Discount, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.amountDiscountCreationParams != null -> @@ -2159,9 +2150,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2183,7 +2172,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** @@ -2396,9 +2385,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2420,7 +2407,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -2631,9 +2618,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2655,7 +2640,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** @@ -2871,7 +2856,7 @@ private constructor( override fun serialize( value: EndDate, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.dateTime != null -> generator.writeObject(value.dateTime) @@ -3960,7 +3945,7 @@ private constructor( "matrix_with_allocation" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -4011,7 +3996,7 @@ private constructor( "threshold_total_amount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -4038,21 +4023,21 @@ private constructor( "max_group_tiered_package" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newFloatingMaxGroupTieredPackage = it, - _json = json + _json = json, ) } } "tiered_with_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -4063,35 +4048,35 @@ private constructor( "package_with_allocation" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newFloatingPackageWithAllocation = it, - _json = json + _json = json, ) } } "tiered_package_with_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newFloatingTieredPackageWithMinimum = it, - _json = json + _json = json, ) } } "unit_with_percent" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -4102,7 +4087,7 @@ private constructor( "tiered_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -4113,7 +4098,7 @@ private constructor( "unit_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -4124,7 +4109,7 @@ private constructor( "grouped_allocation" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -4135,49 +4120,49 @@ private constructor( "grouped_with_prorated_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newFloatingGroupedWithProratedMinimum = it, - _json = json + _json = json, ) } } "grouped_with_metered_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newFloatingGroupedWithMeteredMinimum = it, - _json = json + _json = json, ) } } "matrix_with_display_name" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newFloatingMatrixWithDisplayName = it, - _json = json + _json = json, ) } } "bulk_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -4188,7 +4173,7 @@ private constructor( "grouped_tiered_package" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -4199,14 +4184,14 @@ private constructor( "scalable_matrix_with_unit_pricing" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newFloatingScalableMatrixWithUnitPricing = it, - _json = json + _json = json, ) } } @@ -4215,28 +4200,28 @@ private constructor( node, jacksonTypeRef< NewFloatingScalableMatrixWithTieredPricingPrice - >() + >(), ) { it.validate() } ?.let { return Price( newFloatingScalableMatrixWithTieredPricing = it, - _json = json + _json = json, ) } } "cumulative_grouped_bulk" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newFloatingCumulativeGroupedBulk = it, - _json = json + _json = json, ) } } @@ -4251,7 +4236,7 @@ private constructor( override fun serialize( value: Price, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newFloatingUnit != null -> @@ -4904,9 +4889,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -5024,9 +5007,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -5048,7 +5029,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT, + UNIT } /** @@ -5200,7 +5181,7 @@ private constructor( fun build(): UnitConfig = UnitConfig( checkRequired("unitAmount", unitAmount), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -5344,9 +5325,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -5582,9 +5561,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -5707,7 +5684,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6393,9 +6370,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -6513,9 +6488,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -6537,7 +6510,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE, + PACKAGE } /** @@ -6869,9 +6842,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -7107,9 +7078,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -7232,7 +7201,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -7917,9 +7886,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -8413,9 +8380,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -8437,7 +8402,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MATRIX, + MATRIX } /** @@ -8624,9 +8589,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -8862,9 +8825,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -8987,7 +8948,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -9681,9 +9642,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -10206,9 +10165,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -10230,7 +10187,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MATRIX_WITH_ALLOCATION, + MATRIX_WITH_ALLOCATION } /** @@ -10417,9 +10374,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -10655,9 +10610,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -10780,7 +10733,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -11465,9 +11418,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11585,9 +11536,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11609,7 +11558,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED, + TIERED } /** @@ -11781,7 +11730,7 @@ private constructor( fun build(): TieredConfig = TieredConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -12110,9 +12059,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -12348,9 +12295,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -12473,7 +12418,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -13161,9 +13106,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -13281,9 +13224,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -13305,7 +13246,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_BPS, + TIERED_BPS } /** @@ -13487,7 +13428,7 @@ private constructor( fun build(): TieredBpsConfig = TieredBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -13819,9 +13760,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -14057,9 +13996,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -14182,7 +14119,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -15000,9 +14937,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -15120,9 +15055,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -15144,7 +15077,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BPS, + BPS } /** @@ -15331,9 +15264,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -15569,9 +15500,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -15694,7 +15623,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -16493,7 +16422,7 @@ private constructor( fun build(): BulkBpsConfig = BulkBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -16682,9 +16611,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16802,9 +16729,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16826,7 +16751,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_BPS, + BULK_BPS } /** @@ -17013,9 +16938,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -17251,9 +17174,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -17376,7 +17297,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -18158,7 +18079,7 @@ private constructor( fun build(): BulkConfig = BulkConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -18330,9 +18251,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -18450,9 +18369,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -18474,7 +18391,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK, + BULK } /** @@ -18661,9 +18578,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -18899,9 +18814,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -19024,7 +18937,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -19718,9 +19631,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -19838,9 +19749,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -19862,7 +19771,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - THRESHOLD_TOTAL_AMOUNT, + THRESHOLD_TOTAL_AMOUNT } /** @@ -19932,7 +19841,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -20135,9 +20044,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -20373,9 +20280,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -20498,7 +20403,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -21188,9 +21093,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21308,9 +21211,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21332,7 +21233,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_PACKAGE, + TIERED_PACKAGE } /** @@ -21402,7 +21303,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -21604,9 +21505,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21842,9 +21741,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21967,7 +21864,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -22657,9 +22554,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -22780,7 +22675,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -22862,9 +22757,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -22886,7 +22779,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_TIERED, + GROUPED_TIERED } /** @@ -23073,9 +22966,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -23311,9 +23202,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -23436,7 +23325,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -24117,7 +24006,7 @@ private constructor( checkRequired("itemId", itemId), checkRequired( "maxGroupTieredPackageConfig", - maxGroupTieredPackageConfig + maxGroupTieredPackageConfig, ), checkRequired("modelType", modelType), checkRequired("name", name), @@ -24137,9 +24026,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24260,7 +24147,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -24344,9 +24231,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24368,7 +24253,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MAX_GROUP_TIERED_PACKAGE, + MAX_GROUP_TIERED_PACKAGE } /** @@ -24555,9 +24440,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24793,9 +24676,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24918,7 +24799,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -25610,9 +25491,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -25730,9 +25609,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -25754,7 +25631,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_MINIMUM, + TIERED_WITH_MINIMUM } /** @@ -25824,7 +25701,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -26027,9 +25904,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -26265,9 +26140,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -26390,7 +26263,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -27073,7 +26946,7 @@ private constructor( checkRequired("name", name), checkRequired( "packageWithAllocationConfig", - packageWithAllocationConfig + packageWithAllocationConfig, ), billableMetricId, billedInAdvance, @@ -27091,9 +26964,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27211,9 +27082,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27235,7 +27104,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE_WITH_ALLOCATION, + PACKAGE_WITH_ALLOCATION } /** @@ -27305,7 +27174,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -27509,9 +27378,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27747,9 +27614,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27872,7 +27737,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -28559,7 +28424,7 @@ private constructor( checkRequired("name", name), checkRequired( "tieredPackageWithMinimumConfig", - tieredPackageWithMinimumConfig + tieredPackageWithMinimumConfig, ), billableMetricId, billedInAdvance, @@ -28577,9 +28442,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -28697,9 +28560,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -28722,7 +28583,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_PACKAGE_WITH_MINIMUM, + TIERED_PACKAGE_WITH_MINIMUM } /** @@ -28792,7 +28653,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -28996,9 +28857,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -29234,9 +29093,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -29359,7 +29216,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -30051,9 +29908,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30171,9 +30026,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30195,7 +30048,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PERCENT, + UNIT_WITH_PERCENT } /** @@ -30265,7 +30118,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -30467,9 +30320,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30705,9 +30556,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30830,7 +30679,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -31524,9 +31373,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -31644,9 +31491,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -31668,7 +31513,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_PRORATION, + TIERED_WITH_PRORATION } /** @@ -31738,7 +31583,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -31941,9 +31786,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -32179,9 +32022,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -32304,7 +32145,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -32996,9 +32837,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33116,9 +32955,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33140,7 +32977,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PRORATION, + UNIT_WITH_PRORATION } /** @@ -33210,7 +33047,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -33413,9 +33250,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33651,9 +33486,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33776,7 +33609,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -34468,9 +34301,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -34591,7 +34422,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -34674,9 +34505,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -34698,7 +34527,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_ALLOCATION, + GROUPED_ALLOCATION } /** @@ -34885,9 +34714,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -35123,9 +34950,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -35248,7 +35073,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -35940,7 +35765,7 @@ private constructor( checkRequired("currency", currency), checkRequired( "groupedWithProratedMinimumConfig", - groupedWithProratedMinimumConfig + groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), checkRequired("modelType", modelType), @@ -35961,9 +35786,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -36084,7 +35907,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -36168,9 +35991,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -36193,7 +36014,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_WITH_PRORATED_MINIMUM, + GROUPED_WITH_PRORATED_MINIMUM } /** @@ -36380,9 +36201,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -36618,9 +36437,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -36743,7 +36560,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -37434,7 +37251,7 @@ private constructor( checkRequired("currency", currency), checkRequired( "groupedWithMeteredMinimumConfig", - groupedWithMeteredMinimumConfig + groupedWithMeteredMinimumConfig, ), checkRequired("itemId", itemId), checkRequired("modelType", modelType), @@ -37455,9 +37272,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -37578,7 +37393,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -37662,9 +37477,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -37687,7 +37500,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_WITH_METERED_MINIMUM, + GROUPED_WITH_METERED_MINIMUM } /** @@ -37874,9 +37687,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -38112,9 +37923,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -38237,7 +38046,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -38918,7 +38727,7 @@ private constructor( checkRequired("itemId", itemId), checkRequired( "matrixWithDisplayNameConfig", - matrixWithDisplayNameConfig + matrixWithDisplayNameConfig, ), checkRequired("modelType", modelType), checkRequired("name", name), @@ -38938,9 +38747,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -39061,7 +38868,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -39145,9 +38952,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -39169,7 +38974,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MATRIX_WITH_DISPLAY_NAME, + MATRIX_WITH_DISPLAY_NAME } /** @@ -39356,9 +39161,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -39594,9 +39397,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -39719,7 +39520,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -40413,7 +40214,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -40497,9 +40298,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -40617,9 +40416,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -40641,7 +40438,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_WITH_PRORATION, + BULK_WITH_PRORATION } /** @@ -40828,9 +40625,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -41066,9 +40861,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -41191,7 +40984,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -41885,9 +41678,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -42008,7 +41799,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -42091,9 +41882,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -42115,7 +41904,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_TIERED_PACKAGE, + GROUPED_TIERED_PACKAGE } /** @@ -42302,9 +42091,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -42540,9 +42327,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -42665,7 +42450,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -43366,7 +43151,7 @@ private constructor( checkRequired("name", name), checkRequired( "scalableMatrixWithUnitPricingConfig", - scalableMatrixWithUnitPricingConfig + scalableMatrixWithUnitPricingConfig, ), billableMetricId, billedInAdvance, @@ -43384,9 +43169,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -43504,9 +43287,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -43530,7 +43311,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - SCALABLE_MATRIX_WITH_UNIT_PRICING, + SCALABLE_MATRIX_WITH_UNIT_PRICING } /** @@ -43602,7 +43383,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -43807,9 +43588,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -44045,9 +43824,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -44170,7 +43947,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -44872,7 +44649,7 @@ private constructor( checkRequired("name", name), checkRequired( "scalableMatrixWithTieredPricingConfig", - scalableMatrixWithTieredPricingConfig + scalableMatrixWithTieredPricingConfig, ), billableMetricId, billedInAdvance, @@ -44890,9 +44667,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -45010,9 +44785,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -45036,7 +44809,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - SCALABLE_MATRIX_WITH_TIERED_PRICING, + SCALABLE_MATRIX_WITH_TIERED_PRICING } /** @@ -45108,7 +44881,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -45316,9 +45089,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -45554,9 +45325,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -45679,7 +45448,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -46358,7 +46127,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired( "cumulativeGroupedBulkConfig", - cumulativeGroupedBulkConfig + cumulativeGroupedBulkConfig, ), checkRequired("currency", currency), checkRequired("itemId", itemId), @@ -46380,9 +46149,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -46503,7 +46270,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -46587,9 +46354,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -46611,7 +46376,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - CUMULATIVE_GROUPED_BULK, + CUMULATIVE_GROUPED_BULK } /** @@ -46798,9 +46563,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -47036,9 +46799,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -47161,7 +46922,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -47705,7 +47466,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newPercentageDiscount != null -> @@ -47912,9 +47673,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -47936,7 +47695,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -48208,9 +47967,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -48232,7 +47989,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -48504,9 +48261,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -48528,7 +48283,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -48818,9 +48573,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -48842,7 +48595,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -49113,9 +48866,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -49137,7 +48888,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -49353,7 +49104,7 @@ private constructor( override fun serialize( value: StartDate, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.dateTime != null -> generator.writeObject(value.dateTime) @@ -49497,7 +49248,7 @@ private constructor( override fun serialize( value: EndDate, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.dateTime != null -> generator.writeObject(value.dateTime) @@ -49980,7 +49731,7 @@ private constructor( override fun serialize( value: EndDate, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.dateTime != null -> generator.writeObject(value.dateTime) @@ -50253,7 +50004,7 @@ private constructor( override fun serialize( value: StartDate, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.dateTime != null -> generator.writeObject(value.dateTime) @@ -50601,7 +50352,7 @@ private constructor( override fun serialize( value: EndDate, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.dateTime != null -> generator.writeObject(value.dateTime) @@ -50745,7 +50496,7 @@ private constructor( override fun serialize( value: StartDate, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.dateTime != null -> generator.writeObject(value.dateTime) 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 f7a13612..04dfcbeb 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 @@ -1415,7 +1415,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1426,7 +1426,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1437,14 +1437,14 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Adjustment( planPhasePercentageDiscount = it, - _json = json + _json = json, ) } } @@ -1475,7 +1475,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.planPhaseUsageDiscount != null -> @@ -1773,9 +1773,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1797,7 +1795,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -2160,9 +2158,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2184,7 +2180,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2550,9 +2546,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2574,7 +2568,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2955,9 +2949,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2979,7 +2971,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3341,9 +3333,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3365,7 +3355,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3840,7 +3830,7 @@ private constructor( override fun serialize( value: DiscountInterval, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.amount != null -> generator.writeObject(value.amount) @@ -4100,9 +4090,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4123,7 +4111,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** @@ -4460,9 +4448,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4483,7 +4469,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -4825,9 +4811,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4848,7 +4832,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** @@ -5341,7 +5325,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6788,11 +6772,7 @@ private constructor( "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 8733df7a..da00128b 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 @@ -197,7 +197,7 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionSchedulePlanChangeParams private constructor( private val subscriptionId: String, - private val body: SubscriptionSchedulePlanChangeBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -484,7 +484,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SubscriptionSchedulePlanChangeBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -498,9 +498,9 @@ private constructor( } @NoAutoDetect - class SubscriptionSchedulePlanChangeBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("change_option") @ExcludeMissing private val changeOption: JsonField = JsonMissing.of(), @@ -933,7 +933,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SubscriptionSchedulePlanChangeBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -973,7 +973,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SubscriptionSchedulePlanChangeBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var changeOption: JsonField? = null @@ -1006,44 +1006,33 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - subscriptionSchedulePlanChangeBody: SubscriptionSchedulePlanChangeBody - ) = apply { - changeOption = subscriptionSchedulePlanChangeBody.changeOption - addAdjustments = - subscriptionSchedulePlanChangeBody.addAdjustments.map { it.toMutableList() } - addPrices = subscriptionSchedulePlanChangeBody.addPrices.map { it.toMutableList() } - alignBillingWithPlanChangeDate = - subscriptionSchedulePlanChangeBody.alignBillingWithPlanChangeDate - autoCollection = subscriptionSchedulePlanChangeBody.autoCollection - billingCycleAlignment = subscriptionSchedulePlanChangeBody.billingCycleAlignment - billingCycleAnchorConfiguration = - subscriptionSchedulePlanChangeBody.billingCycleAnchorConfiguration - changeDate = subscriptionSchedulePlanChangeBody.changeDate - couponRedemptionCode = subscriptionSchedulePlanChangeBody.couponRedemptionCode - creditsOverageRate = subscriptionSchedulePlanChangeBody.creditsOverageRate - defaultInvoiceMemo = subscriptionSchedulePlanChangeBody.defaultInvoiceMemo - externalPlanId = subscriptionSchedulePlanChangeBody.externalPlanId - filter = subscriptionSchedulePlanChangeBody.filter - initialPhaseOrder = subscriptionSchedulePlanChangeBody.initialPhaseOrder - invoicingThreshold = subscriptionSchedulePlanChangeBody.invoicingThreshold - netTerms = subscriptionSchedulePlanChangeBody.netTerms - perCreditOverageAmount = subscriptionSchedulePlanChangeBody.perCreditOverageAmount - planId = subscriptionSchedulePlanChangeBody.planId - planVersionNumber = subscriptionSchedulePlanChangeBody.planVersionNumber - priceOverrides = - subscriptionSchedulePlanChangeBody.priceOverrides.map { it.toMutableList() } - removeAdjustments = - subscriptionSchedulePlanChangeBody.removeAdjustments.map { it.toMutableList() } - removePrices = - subscriptionSchedulePlanChangeBody.removePrices.map { it.toMutableList() } - replaceAdjustments = - subscriptionSchedulePlanChangeBody.replaceAdjustments.map { it.toMutableList() } - replacePrices = - subscriptionSchedulePlanChangeBody.replacePrices.map { it.toMutableList() } - trialDurationDays = subscriptionSchedulePlanChangeBody.trialDurationDays - additionalProperties = - subscriptionSchedulePlanChangeBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + changeOption = body.changeOption + addAdjustments = body.addAdjustments.map { it.toMutableList() } + addPrices = body.addPrices.map { it.toMutableList() } + alignBillingWithPlanChangeDate = body.alignBillingWithPlanChangeDate + autoCollection = body.autoCollection + billingCycleAlignment = body.billingCycleAlignment + billingCycleAnchorConfiguration = body.billingCycleAnchorConfiguration + changeDate = body.changeDate + couponRedemptionCode = body.couponRedemptionCode + creditsOverageRate = body.creditsOverageRate + defaultInvoiceMemo = body.defaultInvoiceMemo + externalPlanId = body.externalPlanId + filter = body.filter + initialPhaseOrder = body.initialPhaseOrder + invoicingThreshold = body.invoicingThreshold + netTerms = body.netTerms + perCreditOverageAmount = body.perCreditOverageAmount + planId = body.planId + planVersionNumber = body.planVersionNumber + priceOverrides = body.priceOverrides.map { it.toMutableList() } + removeAdjustments = body.removeAdjustments.map { it.toMutableList() } + removePrices = body.removePrices.map { it.toMutableList() } + replaceAdjustments = body.replaceAdjustments.map { it.toMutableList() } + replacePrices = body.replacePrices.map { it.toMutableList() } + trialDurationDays = body.trialDurationDays + additionalProperties = body.additionalProperties.toMutableMap() } fun changeOption(changeOption: ChangeOption) = changeOption(JsonField.of(changeOption)) @@ -1742,8 +1731,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SubscriptionSchedulePlanChangeBody = - SubscriptionSchedulePlanChangeBody( + fun build(): Body = + Body( checkRequired("changeOption", changeOption), (addAdjustments ?: JsonMissing.of()).map { it.toImmutable() }, (addPrices ?: JsonMissing.of()).map { it.toImmutable() }, @@ -1778,7 +1767,7 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionSchedulePlanChangeBody && changeOption == other.changeOption && addAdjustments == other.addAdjustments && addPrices == other.addPrices && alignBillingWithPlanChangeDate == other.alignBillingWithPlanChangeDate && autoCollection == other.autoCollection && billingCycleAlignment == other.billingCycleAlignment && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && changeDate == other.changeDate && couponRedemptionCode == other.couponRedemptionCode && creditsOverageRate == other.creditsOverageRate && defaultInvoiceMemo == other.defaultInvoiceMemo && externalPlanId == other.externalPlanId && filter == other.filter && initialPhaseOrder == other.initialPhaseOrder && invoicingThreshold == other.invoicingThreshold && netTerms == other.netTerms && perCreditOverageAmount == other.perCreditOverageAmount && planId == other.planId && planVersionNumber == other.planVersionNumber && priceOverrides == other.priceOverrides && removeAdjustments == other.removeAdjustments && removePrices == other.removePrices && replaceAdjustments == other.replaceAdjustments && replacePrices == other.replacePrices && trialDurationDays == other.trialDurationDays && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && changeOption == other.changeOption && addAdjustments == other.addAdjustments && addPrices == other.addPrices && alignBillingWithPlanChangeDate == other.alignBillingWithPlanChangeDate && autoCollection == other.autoCollection && billingCycleAlignment == other.billingCycleAlignment && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && changeDate == other.changeDate && couponRedemptionCode == other.couponRedemptionCode && creditsOverageRate == other.creditsOverageRate && defaultInvoiceMemo == other.defaultInvoiceMemo && externalPlanId == other.externalPlanId && filter == other.filter && initialPhaseOrder == other.initialPhaseOrder && invoicingThreshold == other.invoicingThreshold && netTerms == other.netTerms && perCreditOverageAmount == other.perCreditOverageAmount && planId == other.planId && planVersionNumber == other.planVersionNumber && priceOverrides == other.priceOverrides && removeAdjustments == other.removeAdjustments && removePrices == other.removePrices && replaceAdjustments == other.replaceAdjustments && replacePrices == other.replacePrices && trialDurationDays == other.trialDurationDays && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -1788,7 +1777,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionSchedulePlanChangeBody{changeOption=$changeOption, addAdjustments=$addAdjustments, addPrices=$addPrices, alignBillingWithPlanChangeDate=$alignBillingWithPlanChangeDate, autoCollection=$autoCollection, billingCycleAlignment=$billingCycleAlignment, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, changeDate=$changeDate, couponRedemptionCode=$couponRedemptionCode, creditsOverageRate=$creditsOverageRate, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, filter=$filter, initialPhaseOrder=$initialPhaseOrder, invoicingThreshold=$invoicingThreshold, netTerms=$netTerms, perCreditOverageAmount=$perCreditOverageAmount, planId=$planId, planVersionNumber=$planVersionNumber, priceOverrides=$priceOverrides, removeAdjustments=$removeAdjustments, removePrices=$removePrices, replaceAdjustments=$replaceAdjustments, replacePrices=$replacePrices, trialDurationDays=$trialDurationDays, additionalProperties=$additionalProperties}" + "Body{changeOption=$changeOption, addAdjustments=$addAdjustments, addPrices=$addPrices, alignBillingWithPlanChangeDate=$alignBillingWithPlanChangeDate, autoCollection=$autoCollection, billingCycleAlignment=$billingCycleAlignment, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, changeDate=$changeDate, couponRedemptionCode=$couponRedemptionCode, creditsOverageRate=$creditsOverageRate, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, filter=$filter, initialPhaseOrder=$initialPhaseOrder, invoicingThreshold=$invoicingThreshold, netTerms=$netTerms, perCreditOverageAmount=$perCreditOverageAmount, planId=$planId, planVersionNumber=$planVersionNumber, priceOverrides=$priceOverrides, removeAdjustments=$removeAdjustments, removePrices=$removePrices, replaceAdjustments=$replaceAdjustments, replacePrices=$replacePrices, trialDurationDays=$trialDurationDays, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -1803,8 +1792,7 @@ private constructor( class Builder internal constructor() { private var subscriptionId: String? = null - private var body: SubscriptionSchedulePlanChangeBody.Builder = - SubscriptionSchedulePlanChangeBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -2561,11 +2549,8 @@ private constructor( ) } - class ChangeOption - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ChangeOption @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -3114,7 +3099,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newPercentageDiscount != null -> @@ -3321,9 +3306,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3345,7 +3328,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -3617,9 +3600,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3641,7 +3622,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -3913,9 +3894,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3937,7 +3916,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -4227,9 +4206,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4251,7 +4228,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -4522,9 +4499,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4546,7 +4521,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -5368,11 +5343,8 @@ private constructor( } /** The cadence at which to allocate the amount to the customer. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -5724,9 +5696,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -6532,21 +6502,21 @@ private constructor( "threshold_total_amount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionThresholdTotalAmount = it, - _json = json + _json = json, ) } } "tiered_package" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -6557,21 +6527,21 @@ private constructor( "tiered_with_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionTieredWithMinimum = it, - _json = json + _json = json, ) } } "unit_with_percent" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -6582,84 +6552,84 @@ private constructor( "package_with_allocation" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionPackageWithAllocation = it, - _json = json + _json = json, ) } } "tiered_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionTierWithProration = it, - _json = json + _json = json, ) } } "unit_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionUnitWithProration = it, - _json = json + _json = json, ) } } "grouped_allocation" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionGroupedAllocation = it, - _json = json + _json = json, ) } } "grouped_with_prorated_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionGroupedWithProratedMinimum = it, - _json = json + _json = json, ) } } "bulk_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionBulkWithProration = it, - _json = json + _json = json, ) } } @@ -6674,7 +6644,7 @@ private constructor( override fun serialize( value: Price, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newSubscriptionUnit != null -> @@ -7372,9 +7342,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -7492,9 +7460,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -7516,7 +7482,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT, + UNIT } /** @@ -7668,7 +7634,7 @@ private constructor( fun build(): UnitConfig = UnitConfig( checkRequired("unitAmount", unitAmount), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -7812,9 +7778,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -8050,9 +8014,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -8175,7 +8137,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -8925,9 +8887,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -9045,9 +9005,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -9069,7 +9027,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE, + PACKAGE } /** @@ -9401,9 +9359,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -9639,9 +9595,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -9764,7 +9718,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -10514,9 +10468,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11010,9 +10962,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11034,7 +10984,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MATRIX, + MATRIX } /** @@ -11221,9 +11171,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11459,9 +11407,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -11584,7 +11530,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -12334,9 +12280,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -12454,9 +12398,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -12478,7 +12420,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED, + TIERED } /** @@ -12650,7 +12592,7 @@ private constructor( fun build(): TieredConfig = TieredConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -12979,9 +12921,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -13217,9 +13157,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -13342,7 +13280,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -14094,9 +14032,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -14214,9 +14150,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -14238,7 +14172,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_BPS, + TIERED_BPS } /** @@ -14420,7 +14354,7 @@ private constructor( fun build(): TieredBpsConfig = TieredBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -14752,9 +14686,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -14990,9 +14922,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -15115,7 +15045,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -15997,9 +15927,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16117,9 +16045,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16141,7 +16067,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BPS, + BPS } /** @@ -16328,9 +16254,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16566,9 +16490,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -16691,7 +16613,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -17554,7 +17476,7 @@ private constructor( fun build(): BulkBpsConfig = BulkBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -17743,9 +17665,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -17863,9 +17783,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -17887,7 +17805,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_BPS, + BULK_BPS } /** @@ -18074,9 +17992,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -18312,9 +18228,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -18437,7 +18351,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -19283,7 +19197,7 @@ private constructor( fun build(): BulkConfig = BulkConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -19455,9 +19369,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -19575,9 +19487,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -19599,7 +19509,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK, + BULK } /** @@ -19786,9 +19696,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -20024,9 +19932,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -20149,7 +20055,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -20910,9 +20816,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21030,9 +20934,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21054,7 +20956,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - THRESHOLD_TOTAL_AMOUNT, + THRESHOLD_TOTAL_AMOUNT } /** @@ -21124,7 +21026,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -21327,9 +21229,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21565,9 +21465,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -21690,7 +21588,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -22443,9 +22341,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -22563,9 +22459,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -22587,7 +22481,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_PACKAGE, + TIERED_PACKAGE } /** @@ -22657,7 +22551,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -22859,9 +22753,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -23097,9 +22989,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -23222,7 +23112,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -23980,9 +23870,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24100,9 +23988,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24124,7 +24010,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_MINIMUM, + TIERED_WITH_MINIMUM } /** @@ -24194,7 +24080,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -24397,9 +24283,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24635,9 +24519,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -24760,7 +24642,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -25515,9 +25397,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -25635,9 +25515,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -25659,7 +25537,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PERCENT, + UNIT_WITH_PERCENT } /** @@ -25729,7 +25607,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -25931,9 +25809,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -26169,9 +26045,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -26294,7 +26168,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -27040,7 +26914,7 @@ private constructor( checkRequired("name", name), checkRequired( "packageWithAllocationConfig", - packageWithAllocationConfig + packageWithAllocationConfig, ), billableMetricId, billedInAdvance, @@ -27060,9 +26934,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27180,9 +27052,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27204,7 +27074,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE_WITH_ALLOCATION, + PACKAGE_WITH_ALLOCATION } /** @@ -27274,7 +27144,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -27478,9 +27348,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27716,9 +27584,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -27841,7 +27707,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -28601,9 +28467,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -28721,9 +28585,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -28745,7 +28607,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_PRORATION, + TIERED_WITH_PRORATION } /** @@ -28815,7 +28677,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -29018,9 +28880,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -29256,9 +29116,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -29381,7 +29239,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -30139,9 +29997,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30259,9 +30115,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30283,7 +30137,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PRORATION, + UNIT_WITH_PRORATION } /** @@ -30353,7 +30207,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -30556,9 +30410,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30794,9 +30646,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -30919,7 +30769,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -31677,9 +31527,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -31800,7 +31648,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -31883,9 +31731,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -31907,7 +31753,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_ALLOCATION, + GROUPED_ALLOCATION } /** @@ -32094,9 +31940,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -32332,9 +32176,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -32457,7 +32299,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -33214,7 +33056,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired( "groupedWithProratedMinimumConfig", - groupedWithProratedMinimumConfig + groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), checkRequired("modelType", modelType), @@ -33237,9 +33079,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33360,7 +33200,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -33444,9 +33284,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33469,7 +33307,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_WITH_PRORATED_MINIMUM, + GROUPED_WITH_PRORATED_MINIMUM } /** @@ -33656,9 +33494,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -33894,9 +33730,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -34019,7 +33853,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -34779,7 +34613,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -34863,9 +34697,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -34983,9 +34815,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -35007,7 +34837,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_WITH_PRORATION, + BULK_WITH_PRORATION } /** @@ -35194,9 +35024,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -35432,9 +35260,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -35557,7 +35383,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -35677,9 +35503,7 @@ private constructor( */ class BillingCycleAlignment @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -36066,7 +35890,7 @@ private constructor( fun build(): RemoveAdjustment = RemoveAdjustment( checkRequired("adjustmentId", adjustmentId), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -36196,11 +36020,7 @@ private constructor( } fun build(): RemovePrice = - RemovePrice( - externalPriceId, - priceId, - additionalProperties.toImmutable(), - ) + RemovePrice(externalPriceId, priceId, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -36580,7 +36400,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newPercentageDiscount != null -> @@ -36787,9 +36607,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -36811,7 +36629,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -37083,9 +36901,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -37107,7 +36923,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -37379,9 +37195,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -37403,7 +37217,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -37693,9 +37507,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -37717,7 +37529,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -37988,9 +37800,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -38012,7 +37822,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -38776,11 +38586,8 @@ private constructor( } /** The cadence at which to allocate the amount to the customer. */ - class Cadence - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Cadence @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -39132,9 +38939,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -39940,21 +39745,21 @@ private constructor( "threshold_total_amount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionThresholdTotalAmount = it, - _json = json + _json = json, ) } } "tiered_package" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -39965,21 +39770,21 @@ private constructor( "tiered_with_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionTieredWithMinimum = it, - _json = json + _json = json, ) } } "unit_with_percent" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -39990,84 +39795,84 @@ private constructor( "package_with_allocation" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionPackageWithAllocation = it, - _json = json + _json = json, ) } } "tiered_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionTierWithProration = it, - _json = json + _json = json, ) } } "unit_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionUnitWithProration = it, - _json = json + _json = json, ) } } "grouped_allocation" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionGroupedAllocation = it, - _json = json + _json = json, ) } } "grouped_with_prorated_minimum" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionGroupedWithProratedMinimum = it, - _json = json + _json = json, ) } } "bulk_with_proration" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Price( newSubscriptionBulkWithProration = it, - _json = json + _json = json, ) } } @@ -40082,7 +39887,7 @@ private constructor( override fun serialize( value: Price, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.newSubscriptionUnit != null -> @@ -40780,9 +40585,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -40900,9 +40703,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -40924,7 +40725,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT, + UNIT } /** @@ -41076,7 +40877,7 @@ private constructor( fun build(): UnitConfig = UnitConfig( checkRequired("unitAmount", unitAmount), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -41220,9 +41021,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -41458,9 +41257,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -41583,7 +41380,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -42333,9 +42130,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -42453,9 +42248,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -42477,7 +42270,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE, + PACKAGE } /** @@ -42809,9 +42602,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -43047,9 +42838,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -43172,7 +42961,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -43922,9 +43711,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -44418,9 +44205,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -44442,7 +44227,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - MATRIX, + MATRIX } /** @@ -44629,9 +44414,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -44867,9 +44650,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -44992,7 +44773,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -45742,9 +45523,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -45862,9 +45641,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -45886,7 +45663,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED, + TIERED } /** @@ -46058,7 +45835,7 @@ private constructor( fun build(): TieredConfig = TieredConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -46387,9 +46164,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -46625,9 +46400,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -46750,7 +46523,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -47502,9 +47275,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -47622,9 +47393,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -47646,7 +47415,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_BPS, + TIERED_BPS } /** @@ -47828,7 +47597,7 @@ private constructor( fun build(): TieredBpsConfig = TieredBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -48160,9 +47929,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -48398,9 +48165,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -48523,7 +48288,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -49405,9 +49170,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -49525,9 +49288,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -49549,7 +49310,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BPS, + BPS } /** @@ -49736,9 +49497,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -49974,9 +49733,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -50099,7 +49856,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -50962,7 +50719,7 @@ private constructor( fun build(): BulkBpsConfig = BulkBpsConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -51151,9 +50908,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -51271,9 +51026,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -51295,7 +51048,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_BPS, + BULK_BPS } /** @@ -51482,9 +51235,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -51720,9 +51471,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -51845,7 +51594,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -52691,7 +52440,7 @@ private constructor( fun build(): BulkConfig = BulkConfig( checkRequired("tiers", tiers).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -52863,9 +52612,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -52983,9 +52730,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -53007,7 +52752,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK, + BULK } /** @@ -53194,9 +52939,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -53432,9 +53175,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -53557,7 +53298,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -54318,9 +54059,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -54438,9 +54177,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -54462,7 +54199,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - THRESHOLD_TOTAL_AMOUNT, + THRESHOLD_TOTAL_AMOUNT } /** @@ -54532,7 +54269,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -54735,9 +54472,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -54973,9 +54708,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -55098,7 +54831,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -55851,9 +55584,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -55971,9 +55702,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -55995,7 +55724,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_PACKAGE, + TIERED_PACKAGE } /** @@ -56065,7 +55794,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -56267,9 +55996,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -56505,9 +56232,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -56630,7 +56355,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -57388,9 +57113,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -57508,9 +57231,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -57532,7 +57253,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_MINIMUM, + TIERED_WITH_MINIMUM } /** @@ -57602,7 +57323,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -57805,9 +57526,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -58043,9 +57762,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -58168,7 +57885,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -58923,9 +58640,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -59043,9 +58758,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -59067,7 +58780,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PERCENT, + UNIT_WITH_PERCENT } /** @@ -59137,7 +58850,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -59339,9 +59052,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -59577,9 +59288,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -59702,7 +59411,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -60448,7 +60157,7 @@ private constructor( checkRequired("name", name), checkRequired( "packageWithAllocationConfig", - packageWithAllocationConfig + packageWithAllocationConfig, ), billableMetricId, billedInAdvance, @@ -60468,9 +60177,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -60588,9 +60295,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -60612,7 +60317,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - PACKAGE_WITH_ALLOCATION, + PACKAGE_WITH_ALLOCATION } /** @@ -60682,7 +60387,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -60886,9 +60591,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -61124,9 +60827,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -61249,7 +60950,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -62009,9 +61710,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -62129,9 +61828,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -62153,7 +61850,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - TIERED_WITH_PRORATION, + TIERED_WITH_PRORATION } /** @@ -62223,7 +61920,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -62426,9 +62123,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -62664,9 +62359,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -62789,7 +62482,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -63547,9 +63240,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -63667,9 +63358,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -63691,7 +63380,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - UNIT_WITH_PRORATION, + UNIT_WITH_PRORATION } /** @@ -63761,7 +63450,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -63964,9 +63653,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -64202,9 +63889,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -64327,7 +64012,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -65085,9 +64770,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -65208,7 +64891,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -65291,9 +64974,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -65315,7 +64996,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_ALLOCATION, + GROUPED_ALLOCATION } /** @@ -65502,9 +65183,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -65740,9 +65419,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -65865,7 +65542,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -66622,7 +66299,7 @@ private constructor( checkRequired("cadence", cadence), checkRequired( "groupedWithProratedMinimumConfig", - groupedWithProratedMinimumConfig + groupedWithProratedMinimumConfig, ), checkRequired("itemId", itemId), checkRequired("modelType", modelType), @@ -66645,9 +66322,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -66768,7 +66443,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -66852,9 +66527,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -66877,7 +66550,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - GROUPED_WITH_PRORATED_MINIMUM, + GROUPED_WITH_PRORATED_MINIMUM } /** @@ -67064,9 +66737,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -67302,9 +66973,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -67427,7 +67096,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -68187,7 +67856,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -68271,9 +67940,7 @@ private constructor( /** The cadence to bill for this price on. */ class Cadence @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -68391,9 +68058,7 @@ private constructor( class ModelType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -68415,7 +68080,7 @@ private constructor( /** An enum containing [ModelType]'s known values. */ enum class Known { - BULK_WITH_PRORATION, + BULK_WITH_PRORATION } /** @@ -68602,9 +68267,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -68840,9 +68503,7 @@ private constructor( /** The unit of billing period duration. */ class DurationUnit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -68965,7 +68626,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 9a61031f..ad671cdd 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 @@ -1416,7 +1416,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1427,7 +1427,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1438,14 +1438,14 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Adjustment( planPhasePercentageDiscount = it, - _json = json + _json = json, ) } } @@ -1476,7 +1476,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.planPhaseUsageDiscount != null -> @@ -1774,9 +1774,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1798,7 +1796,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -2161,9 +2159,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2185,7 +2181,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2551,9 +2547,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2575,7 +2569,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2956,9 +2950,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2980,7 +2972,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3342,9 +3334,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3366,7 +3356,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3841,7 +3831,7 @@ private constructor( override fun serialize( value: DiscountInterval, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.amount != null -> generator.writeObject(value.amount) @@ -4101,9 +4091,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4124,7 +4112,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** @@ -4461,9 +4449,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4484,7 +4470,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -4826,9 +4812,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4849,7 +4833,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** @@ -5342,7 +5326,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6789,11 +6773,7 @@ private constructor( "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 a7786a65..7907d22f 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 @@ -25,7 +25,7 @@ import java.util.Optional class SubscriptionTriggerPhaseParams private constructor( private val subscriptionId: String, - private val body: SubscriptionTriggerPhaseBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -64,7 +64,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SubscriptionTriggerPhaseBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -78,9 +78,9 @@ private constructor( } @NoAutoDetect - class SubscriptionTriggerPhaseBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("allow_invoice_credit_or_void") @ExcludeMissing private val allowInvoiceCreditOrVoid: JsonField = JsonMissing.of(), @@ -131,7 +131,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SubscriptionTriggerPhaseBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -148,7 +148,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SubscriptionTriggerPhaseBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var allowInvoiceCreditOrVoid: JsonField = JsonMissing.of() @@ -156,11 +156,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(subscriptionTriggerPhaseBody: SubscriptionTriggerPhaseBody) = apply { - allowInvoiceCreditOrVoid = subscriptionTriggerPhaseBody.allowInvoiceCreditOrVoid - effectiveDate = subscriptionTriggerPhaseBody.effectiveDate - additionalProperties = - subscriptionTriggerPhaseBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + allowInvoiceCreditOrVoid = body.allowInvoiceCreditOrVoid + effectiveDate = body.effectiveDate + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -238,12 +237,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SubscriptionTriggerPhaseBody = - SubscriptionTriggerPhaseBody( - allowInvoiceCreditOrVoid, - effectiveDate, - additionalProperties.toImmutable(), - ) + fun build(): Body = + Body(allowInvoiceCreditOrVoid, effectiveDate, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -251,7 +246,7 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionTriggerPhaseBody && allowInvoiceCreditOrVoid == other.allowInvoiceCreditOrVoid && effectiveDate == other.effectiveDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && allowInvoiceCreditOrVoid == other.allowInvoiceCreditOrVoid && effectiveDate == other.effectiveDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -261,7 +256,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionTriggerPhaseBody{allowInvoiceCreditOrVoid=$allowInvoiceCreditOrVoid, effectiveDate=$effectiveDate, additionalProperties=$additionalProperties}" + "Body{allowInvoiceCreditOrVoid=$allowInvoiceCreditOrVoid, effectiveDate=$effectiveDate, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -276,8 +271,7 @@ private constructor( class Builder internal constructor() { private var subscriptionId: String? = null - private var body: SubscriptionTriggerPhaseBody.Builder = - SubscriptionTriggerPhaseBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() 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 9b4d1975..95802c4a 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 @@ -1413,7 +1413,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1424,7 +1424,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1435,14 +1435,14 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Adjustment( planPhasePercentageDiscount = it, - _json = json + _json = json, ) } } @@ -1473,7 +1473,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.planPhaseUsageDiscount != null -> @@ -1771,9 +1771,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1795,7 +1793,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -2158,9 +2156,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2182,7 +2178,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2548,9 +2544,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2572,7 +2566,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2953,9 +2947,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2977,7 +2969,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3339,9 +3331,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3363,7 +3353,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3838,7 +3828,7 @@ private constructor( override fun serialize( value: DiscountInterval, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.amount != null -> generator.writeObject(value.amount) @@ -4098,9 +4088,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4121,7 +4109,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** @@ -4458,9 +4446,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4481,7 +4467,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -4823,9 +4809,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4846,7 +4830,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** @@ -5339,7 +5323,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6786,11 +6770,7 @@ private constructor( "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 610c1c27..52b70475 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 @@ -1422,7 +1422,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1433,7 +1433,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1444,14 +1444,14 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Adjustment( planPhasePercentageDiscount = it, - _json = json + _json = json, ) } } @@ -1482,7 +1482,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.planPhaseUsageDiscount != null -> @@ -1780,9 +1780,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1804,7 +1802,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -2167,9 +2165,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2191,7 +2187,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2557,9 +2553,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2581,7 +2575,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2962,9 +2956,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2986,7 +2978,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3348,9 +3340,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3372,7 +3362,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3847,7 +3837,7 @@ private constructor( override fun serialize( value: DiscountInterval, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.amount != null -> generator.writeObject(value.amount) @@ -4107,9 +4097,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4130,7 +4118,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** @@ -4467,9 +4455,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4490,7 +4476,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -4832,9 +4818,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4855,7 +4839,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** @@ -5348,7 +5332,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6795,11 +6779,7 @@ private constructor( "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 24ac5bf6..9fa30238 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 @@ -28,7 +28,7 @@ import java.util.Objects class SubscriptionUnscheduleFixedFeeQuantityUpdatesParams private constructor( private val subscriptionId: String, - private val body: SubscriptionUnscheduleFixedFeeQuantityUpdatesBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -47,7 +47,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SubscriptionUnscheduleFixedFeeQuantityUpdatesBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -61,9 +61,9 @@ private constructor( } @NoAutoDetect - class SubscriptionUnscheduleFixedFeeQuantityUpdatesBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("price_id") @ExcludeMissing private val priceId: JsonField = JsonMissing.of(), @@ -83,7 +83,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SubscriptionUnscheduleFixedFeeQuantityUpdatesBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -99,21 +99,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SubscriptionUnscheduleFixedFeeQuantityUpdatesBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var priceId: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - subscriptionUnscheduleFixedFeeQuantityUpdatesBody: - SubscriptionUnscheduleFixedFeeQuantityUpdatesBody - ) = apply { - priceId = subscriptionUnscheduleFixedFeeQuantityUpdatesBody.priceId - additionalProperties = - subscriptionUnscheduleFixedFeeQuantityUpdatesBody.additionalProperties - .toMutableMap() + internal fun from(body: Body) = apply { + priceId = body.priceId + additionalProperties = body.additionalProperties.toMutableMap() } /** Price for which the updates should be cleared. Must be a fixed fee. */ @@ -141,11 +136,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SubscriptionUnscheduleFixedFeeQuantityUpdatesBody = - SubscriptionUnscheduleFixedFeeQuantityUpdatesBody( - checkRequired("priceId", priceId), - additionalProperties.toImmutable() - ) + fun build(): Body = + Body(checkRequired("priceId", priceId), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -153,7 +145,7 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionUnscheduleFixedFeeQuantityUpdatesBody && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -163,7 +155,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionUnscheduleFixedFeeQuantityUpdatesBody{priceId=$priceId, additionalProperties=$additionalProperties}" + "Body{priceId=$priceId, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -178,8 +170,7 @@ private constructor( class Builder internal constructor() { private var subscriptionId: String? = null - private var body: SubscriptionUnscheduleFixedFeeQuantityUpdatesBody.Builder = - SubscriptionUnscheduleFixedFeeQuantityUpdatesBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() 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 b4735d78..359459c4 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 @@ -1430,7 +1430,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1441,7 +1441,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1452,14 +1452,14 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Adjustment( planPhasePercentageDiscount = it, - _json = json + _json = json, ) } } @@ -1490,7 +1490,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.planPhaseUsageDiscount != null -> @@ -1788,9 +1788,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1812,7 +1810,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -2175,9 +2173,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2199,7 +2195,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2565,9 +2561,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2589,7 +2583,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2970,9 +2964,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2994,7 +2986,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3356,9 +3348,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3380,7 +3370,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3855,7 +3845,7 @@ private constructor( override fun serialize( value: DiscountInterval, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.amount != null -> generator.writeObject(value.amount) @@ -4115,9 +4105,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4138,7 +4126,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** @@ -4475,9 +4463,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4498,7 +4484,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -4840,9 +4826,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4863,7 +4847,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** @@ -5356,7 +5340,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6803,11 +6787,7 @@ private constructor( "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 45b76307..66c0fb2e 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 @@ -1426,7 +1426,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1437,7 +1437,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1448,14 +1448,14 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Adjustment( planPhasePercentageDiscount = it, - _json = json + _json = json, ) } } @@ -1486,7 +1486,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.planPhaseUsageDiscount != null -> @@ -1784,9 +1784,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1808,7 +1806,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -2171,9 +2169,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2195,7 +2191,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2561,9 +2557,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2585,7 +2579,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2966,9 +2960,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2990,7 +2982,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3352,9 +3344,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3376,7 +3366,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3851,7 +3841,7 @@ private constructor( override fun serialize( value: DiscountInterval, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.amount != null -> generator.writeObject(value.amount) @@ -4111,9 +4101,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4134,7 +4122,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** @@ -4471,9 +4459,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4494,7 +4480,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -4836,9 +4822,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4859,7 +4843,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** @@ -5352,7 +5336,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6799,11 +6783,7 @@ private constructor( "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 86979e81..c5bd4fa0 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 @@ -40,7 +40,7 @@ import java.util.Optional class SubscriptionUpdateFixedFeeQuantityParams private constructor( private val subscriptionId: String, - private val body: SubscriptionUpdateFixedFeeQuantityBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -105,7 +105,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SubscriptionUpdateFixedFeeQuantityBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -119,9 +119,9 @@ private constructor( } @NoAutoDetect - class SubscriptionUpdateFixedFeeQuantityBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("price_id") @ExcludeMissing private val priceId: JsonField = JsonMissing.of(), @@ -210,7 +210,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SubscriptionUpdateFixedFeeQuantityBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -230,7 +230,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SubscriptionUpdateFixedFeeQuantityBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var priceId: JsonField? = null @@ -241,17 +241,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - subscriptionUpdateFixedFeeQuantityBody: SubscriptionUpdateFixedFeeQuantityBody - ) = apply { - priceId = subscriptionUpdateFixedFeeQuantityBody.priceId - quantity = subscriptionUpdateFixedFeeQuantityBody.quantity - allowInvoiceCreditOrVoid = - subscriptionUpdateFixedFeeQuantityBody.allowInvoiceCreditOrVoid - changeOption = subscriptionUpdateFixedFeeQuantityBody.changeOption - effectiveDate = subscriptionUpdateFixedFeeQuantityBody.effectiveDate - additionalProperties = - subscriptionUpdateFixedFeeQuantityBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + priceId = body.priceId + quantity = body.quantity + allowInvoiceCreditOrVoid = body.allowInvoiceCreditOrVoid + changeOption = body.changeOption + effectiveDate = body.effectiveDate + additionalProperties = body.additionalProperties.toMutableMap() } /** Price for which the quantity should be updated. Must be a fixed fee. */ @@ -358,8 +354,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SubscriptionUpdateFixedFeeQuantityBody = - SubscriptionUpdateFixedFeeQuantityBody( + fun build(): Body = + Body( checkRequired("priceId", priceId), checkRequired("quantity", quantity), allowInvoiceCreditOrVoid, @@ -374,7 +370,7 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionUpdateFixedFeeQuantityBody && priceId == other.priceId && quantity == other.quantity && allowInvoiceCreditOrVoid == other.allowInvoiceCreditOrVoid && changeOption == other.changeOption && effectiveDate == other.effectiveDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && priceId == other.priceId && quantity == other.quantity && allowInvoiceCreditOrVoid == other.allowInvoiceCreditOrVoid && changeOption == other.changeOption && effectiveDate == other.effectiveDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -384,7 +380,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionUpdateFixedFeeQuantityBody{priceId=$priceId, quantity=$quantity, allowInvoiceCreditOrVoid=$allowInvoiceCreditOrVoid, changeOption=$changeOption, effectiveDate=$effectiveDate, additionalProperties=$additionalProperties}" + "Body{priceId=$priceId, quantity=$quantity, allowInvoiceCreditOrVoid=$allowInvoiceCreditOrVoid, changeOption=$changeOption, effectiveDate=$effectiveDate, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -399,8 +395,7 @@ private constructor( class Builder internal constructor() { private var subscriptionId: String? = null - private var body: SubscriptionUpdateFixedFeeQuantityBody.Builder = - SubscriptionUpdateFixedFeeQuantityBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -634,11 +629,8 @@ private constructor( * defaults to `effective_date`. Otherwise, this defaults to `immediate` unless it's explicitly * set to `upcoming_invoice. */ - class ChangeOption - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ChangeOption @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. 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 1df3726b..950bf0e1 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 @@ -1422,7 +1422,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1433,7 +1433,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1444,14 +1444,14 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Adjustment( planPhasePercentageDiscount = it, - _json = json + _json = json, ) } } @@ -1482,7 +1482,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.planPhaseUsageDiscount != null -> @@ -1780,9 +1780,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1804,7 +1802,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -2167,9 +2165,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2191,7 +2187,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2557,9 +2553,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2581,7 +2575,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2962,9 +2956,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2986,7 +2978,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3348,9 +3340,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3372,7 +3362,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3847,7 +3837,7 @@ private constructor( override fun serialize( value: DiscountInterval, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.amount != null -> generator.writeObject(value.amount) @@ -4107,9 +4097,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4130,7 +4118,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** @@ -4467,9 +4455,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4490,7 +4476,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -4832,9 +4818,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4855,7 +4839,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** @@ -5348,7 +5332,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6795,11 +6779,7 @@ private constructor( "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. 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 1c06a8c4..9c9902d4 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 @@ -27,7 +27,7 @@ import java.util.Optional class SubscriptionUpdateParams private constructor( private val subscriptionId: String, - private val body: SubscriptionUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -106,7 +106,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SubscriptionUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -120,9 +120,9 @@ private constructor( } @NoAutoDetect - class SubscriptionUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("auto_collection") @ExcludeMissing private val autoCollection: JsonField = JsonMissing.of(), @@ -225,7 +225,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SubscriptionUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -245,7 +245,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SubscriptionUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var autoCollection: JsonField = JsonMissing.of() @@ -256,13 +256,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(subscriptionUpdateBody: SubscriptionUpdateBody) = apply { - autoCollection = subscriptionUpdateBody.autoCollection - defaultInvoiceMemo = subscriptionUpdateBody.defaultInvoiceMemo - invoicingThreshold = subscriptionUpdateBody.invoicingThreshold - metadata = subscriptionUpdateBody.metadata - netTerms = subscriptionUpdateBody.netTerms - additionalProperties = subscriptionUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + autoCollection = body.autoCollection + defaultInvoiceMemo = body.defaultInvoiceMemo + invoicingThreshold = body.invoicingThreshold + metadata = body.metadata + netTerms = body.netTerms + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -418,8 +418,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SubscriptionUpdateBody = - SubscriptionUpdateBody( + fun build(): Body = + Body( autoCollection, defaultInvoiceMemo, invoicingThreshold, @@ -434,7 +434,7 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionUpdateBody && autoCollection == other.autoCollection && defaultInvoiceMemo == other.defaultInvoiceMemo && invoicingThreshold == other.invoicingThreshold && metadata == other.metadata && netTerms == other.netTerms && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && autoCollection == other.autoCollection && defaultInvoiceMemo == other.defaultInvoiceMemo && invoicingThreshold == other.invoicingThreshold && metadata == other.metadata && netTerms == other.netTerms && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -444,7 +444,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionUpdateBody{autoCollection=$autoCollection, defaultInvoiceMemo=$defaultInvoiceMemo, invoicingThreshold=$invoicingThreshold, metadata=$metadata, netTerms=$netTerms, additionalProperties=$additionalProperties}" + "Body{autoCollection=$autoCollection, defaultInvoiceMemo=$defaultInvoiceMemo, invoicingThreshold=$invoicingThreshold, metadata=$metadata, netTerms=$netTerms, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -459,7 +459,7 @@ private constructor( class Builder internal constructor() { private var subscriptionId: String? = null - private var body: SubscriptionUpdateBody.Builder = SubscriptionUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -740,7 +740,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter 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 475c9e72..6b95410c 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 @@ -54,7 +54,7 @@ import java.util.Optional class SubscriptionUpdateTrialParams private constructor( private val subscriptionId: String, - private val body: SubscriptionUpdateTrialBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -91,7 +91,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SubscriptionUpdateTrialBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -105,9 +105,9 @@ private constructor( } @NoAutoDetect - class SubscriptionUpdateTrialBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("trial_end_date") @ExcludeMissing private val trialEndDate: JsonField = JsonMissing.of(), @@ -150,7 +150,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SubscriptionUpdateTrialBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -167,7 +167,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SubscriptionUpdateTrialBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var trialEndDate: JsonField? = null @@ -175,11 +175,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(subscriptionUpdateTrialBody: SubscriptionUpdateTrialBody) = apply { - trialEndDate = subscriptionUpdateTrialBody.trialEndDate - shift = subscriptionUpdateTrialBody.shift - additionalProperties = - subscriptionUpdateTrialBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + trialEndDate = body.trialEndDate + shift = body.shift + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -241,8 +240,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SubscriptionUpdateTrialBody = - SubscriptionUpdateTrialBody( + fun build(): Body = + Body( checkRequired("trialEndDate", trialEndDate), shift, additionalProperties.toImmutable(), @@ -254,7 +253,7 @@ private constructor( return true } - return /* spotless:off */ other is SubscriptionUpdateTrialBody && trialEndDate == other.trialEndDate && shift == other.shift && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && trialEndDate == other.trialEndDate && shift == other.shift && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -264,7 +263,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SubscriptionUpdateTrialBody{trialEndDate=$trialEndDate, shift=$shift, additionalProperties=$additionalProperties}" + "Body{trialEndDate=$trialEndDate, shift=$shift, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -279,8 +278,7 @@ private constructor( class Builder internal constructor() { private var subscriptionId: String? = null - private var body: SubscriptionUpdateTrialBody.Builder = - SubscriptionUpdateTrialBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -589,7 +587,7 @@ private constructor( override fun serialize( value: TrialEndDate, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.offsetDateTime != null -> generator.writeObject(value.offsetDateTime) @@ -600,11 +598,8 @@ private constructor( } } - class UnionMember1 - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class UnionMember1 @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -625,7 +620,7 @@ private constructor( /** An enum containing [UnionMember1]'s known values. */ enum class Known { - IMMEDIATE, + IMMEDIATE } /** 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 3b15ab55..3f9ecd23 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 @@ -1413,7 +1413,7 @@ private constructor( "usage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1424,7 +1424,7 @@ private constructor( "amount_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } @@ -1435,14 +1435,14 @@ private constructor( "percentage_discount" -> { tryDeserialize( node, - jacksonTypeRef() + jacksonTypeRef(), ) { it.validate() } ?.let { return Adjustment( planPhasePercentageDiscount = it, - _json = json + _json = json, ) } } @@ -1473,7 +1473,7 @@ private constructor( override fun serialize( value: Adjustment, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.planPhaseUsageDiscount != null -> @@ -1771,9 +1771,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1795,7 +1793,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - USAGE_DISCOUNT, + USAGE_DISCOUNT } /** @@ -2158,9 +2156,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2182,7 +2178,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - AMOUNT_DISCOUNT, + AMOUNT_DISCOUNT } /** @@ -2548,9 +2544,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2572,7 +2566,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - PERCENTAGE_DISCOUNT, + PERCENTAGE_DISCOUNT } /** @@ -2953,9 +2947,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2977,7 +2969,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MINIMUM, + MINIMUM } /** @@ -3339,9 +3331,7 @@ private constructor( class AdjustmentType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3363,7 +3353,7 @@ private constructor( /** An enum containing [AdjustmentType]'s known values. */ enum class Known { - MAXIMUM, + MAXIMUM } /** @@ -3838,7 +3828,7 @@ private constructor( override fun serialize( value: DiscountInterval, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.amount != null -> generator.writeObject(value.amount) @@ -4098,9 +4088,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4121,7 +4109,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - AMOUNT, + AMOUNT } /** @@ -4458,9 +4446,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4481,7 +4467,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - PERCENTAGE, + PERCENTAGE } /** @@ -4823,9 +4809,7 @@ private constructor( class DiscountType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4846,7 +4830,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - USAGE, + USAGE } /** @@ -5339,7 +5323,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -6786,11 +6770,7 @@ private constructor( "RedeemedCoupon{couponId=$couponId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUsage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUsage.kt index 340b8860..567b2e5f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUsage.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUsage.kt @@ -158,7 +158,7 @@ private constructor( override fun serialize( value: SubscriptionUsage, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.ungrouped != null -> generator.writeObject(value.ungrouped) @@ -260,7 +260,7 @@ private constructor( fun build(): UngroupedSubscriptionUsage = UngroupedSubscriptionUsage( checkRequired("data", data).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -655,11 +655,8 @@ private constructor( "Usage{quantity=$quantity, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, additionalProperties=$additionalProperties}" } - class ViewMode - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ViewMode @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1438,11 +1435,8 @@ private constructor( "Usage{quantity=$quantity, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, additionalProperties=$additionalProperties}" } - class ViewMode - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ViewMode @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/TopLevelPingResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/TopLevelPingResponse.kt index 19984a49..f1c0896a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/TopLevelPingResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/TopLevelPingResponse.kt @@ -90,7 +90,7 @@ private constructor( fun build(): TopLevelPingResponse = TopLevelPingResponse( checkRequired("response", response), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/TrialDiscount.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/TrialDiscount.kt index 5e9388c2..4bf975c5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/TrialDiscount.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/TrialDiscount.kt @@ -234,11 +234,8 @@ private constructor( ) } - class DiscountType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class DiscountType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -259,7 +256,7 @@ private constructor( /** An enum containing [DiscountType]'s known values. */ enum class Known { - TRIAL, + TRIAL } /** 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 74fb0e0b..e736a079 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 @@ -23,14 +23,14 @@ interface AlertServiceAsync { @JvmOverloads fun retrieve( params: AlertRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** This endpoint updates the thresholds of an alert. */ @JvmOverloads fun update( params: AlertUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -47,7 +47,7 @@ interface AlertServiceAsync { @JvmOverloads fun list( params: AlertListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -61,7 +61,7 @@ interface AlertServiceAsync { @JvmOverloads fun createForCustomer( params: AlertCreateForCustomerParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -75,7 +75,7 @@ interface AlertServiceAsync { @JvmOverloads fun createForExternalCustomer( params: AlertCreateForExternalCustomerParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -93,7 +93,7 @@ interface AlertServiceAsync { @JvmOverloads fun createForSubscription( params: AlertCreateForSubscriptionParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -104,7 +104,7 @@ interface AlertServiceAsync { @JvmOverloads fun disable( params: AlertDisableParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -115,6 +115,6 @@ interface AlertServiceAsync { @JvmOverloads fun enable( params: AlertEnableParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 b4d8f1e5..f4841a10 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 @@ -25,10 +25,8 @@ import com.withorb.api.models.AlertRetrieveParams import com.withorb.api.models.AlertUpdateParams import java.util.concurrent.CompletableFuture -class AlertServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : AlertServiceAsync { +class AlertServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + AlertServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -38,7 +36,7 @@ internal constructor( /** This endpoint retrieves an alert by its ID. */ override fun retrieve( params: AlertRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -65,7 +63,7 @@ internal constructor( /** This endpoint updates the thresholds of an alert. */ override fun update( params: AlertUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -104,7 +102,7 @@ internal constructor( */ override fun list( params: AlertListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -139,7 +137,7 @@ internal constructor( */ override fun createForCustomer( params: AlertCreateForCustomerParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -174,7 +172,7 @@ internal constructor( */ override fun createForExternalCustomer( params: AlertCreateForExternalCustomerParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -213,7 +211,7 @@ internal constructor( */ override fun createForSubscription( params: AlertCreateForSubscriptionParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -245,7 +243,7 @@ internal constructor( */ override fun disable( params: AlertDisableParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -277,7 +275,7 @@ internal constructor( */ override fun enable( params: AlertEnableParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 66ede57f..a82dd738 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 @@ -25,7 +25,7 @@ interface CouponServiceAsync { @JvmOverloads fun create( params: CouponCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -39,7 +39,7 @@ interface CouponServiceAsync { @JvmOverloads fun list( params: CouponListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -50,7 +50,7 @@ interface CouponServiceAsync { @JvmOverloads fun archive( params: CouponArchiveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -60,6 +60,6 @@ interface CouponServiceAsync { @JvmOverloads fun fetch( params: CouponFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 03cbcecd..6703534b 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 @@ -23,10 +23,8 @@ import com.withorb.api.services.async.coupons.SubscriptionServiceAsync import com.withorb.api.services.async.coupons.SubscriptionServiceAsyncImpl import java.util.concurrent.CompletableFuture -class CouponServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CouponServiceAsync { +class CouponServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + CouponServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -45,7 +43,7 @@ internal constructor( */ override fun create( params: CouponCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -81,7 +79,7 @@ internal constructor( */ override fun list( params: CouponListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -113,7 +111,7 @@ internal constructor( */ override fun archive( params: CouponArchiveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -144,7 +142,7 @@ internal constructor( */ override fun fetch( params: CouponFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 0838fdaa..47533c60 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 @@ -18,7 +18,7 @@ interface CreditNoteServiceAsync { @JvmOverloads fun create( params: CreditNoteCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -29,7 +29,7 @@ interface CreditNoteServiceAsync { @JvmOverloads fun list( params: CreditNoteListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -39,6 +39,6 @@ interface CreditNoteServiceAsync { @JvmOverloads fun fetch( params: CreditNoteFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 7a8ca52b..35238222 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 @@ -20,10 +20,8 @@ import com.withorb.api.models.CreditNoteListPageAsync import com.withorb.api.models.CreditNoteListParams import java.util.concurrent.CompletableFuture -class CreditNoteServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CreditNoteServiceAsync { +class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + CreditNoteServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -33,7 +31,7 @@ internal constructor( /** This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). */ override fun create( params: CreditNoteCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -66,7 +64,7 @@ internal constructor( */ override fun list( params: CreditNoteListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -97,7 +95,7 @@ internal constructor( */ override fun fetch( params: CreditNoteFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 d9d8cdd9..add76de8 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 @@ -45,7 +45,7 @@ interface CustomerServiceAsync { @JvmOverloads fun create( params: CustomerCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -57,7 +57,7 @@ interface CustomerServiceAsync { @JvmOverloads fun update( params: CustomerUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -70,7 +70,7 @@ interface CustomerServiceAsync { @JvmOverloads fun list( params: CustomerListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -91,7 +91,7 @@ interface CustomerServiceAsync { @JvmOverloads fun delete( params: CustomerDeleteParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -104,7 +104,7 @@ interface CustomerServiceAsync { @JvmOverloads fun fetch( params: CustomerFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -117,7 +117,7 @@ interface CustomerServiceAsync { @JvmOverloads fun fetchByExternalId( params: CustomerFetchByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -131,7 +131,7 @@ interface CustomerServiceAsync { @JvmOverloads fun syncPaymentMethodsFromGateway( params: CustomerSyncPaymentMethodsFromGatewayParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -145,7 +145,7 @@ interface CustomerServiceAsync { @JvmOverloads fun syncPaymentMethodsFromGatewayByExternalCustomerId( params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -156,6 +156,6 @@ interface CustomerServiceAsync { @JvmOverloads fun updateByExternalId( params: CustomerUpdateByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 4bf874ac..01a8f83a 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 @@ -33,10 +33,8 @@ import com.withorb.api.services.async.customers.CreditServiceAsync import com.withorb.api.services.async.customers.CreditServiceAsyncImpl import java.util.concurrent.CompletableFuture -class CustomerServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CustomerServiceAsync { +class CustomerServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + CustomerServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -72,7 +70,7 @@ internal constructor( */ override fun create( params: CustomerCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -105,7 +103,7 @@ internal constructor( */ override fun update( params: CustomerUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -140,7 +138,7 @@ internal constructor( */ override fun list( params: CustomerListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -181,7 +179,7 @@ internal constructor( */ override fun delete( params: CustomerDeleteParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -207,7 +205,7 @@ internal constructor( */ override fun fetch( params: CustomerFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -240,7 +238,7 @@ internal constructor( */ override fun fetchByExternalId( params: CustomerFetchByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -274,7 +272,7 @@ internal constructor( */ override fun syncPaymentMethodsFromGateway( params: CustomerSyncPaymentMethodsFromGatewayParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -283,7 +281,7 @@ internal constructor( "customers", "external_customer_id", params.getPathParam(0), - "sync_payment_methods_from_gateway" + "sync_payment_methods_from_gateway", ) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -308,7 +306,7 @@ internal constructor( */ override fun syncPaymentMethodsFromGatewayByExternalCustomerId( params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -316,7 +314,7 @@ internal constructor( .addPathSegments( "customers", params.getPathParam(0), - "sync_payment_methods_from_gateway" + "sync_payment_methods_from_gateway", ) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -338,7 +336,7 @@ internal constructor( */ override fun updateByExternalId( params: CustomerUpdateByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 80f07f55..073b90c8 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 @@ -29,20 +29,20 @@ interface DimensionalPriceGroupServiceAsync { @JvmOverloads fun create( params: DimensionalPriceGroupCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Fetch dimensional price group */ @JvmOverloads fun retrieve( params: DimensionalPriceGroupRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** List dimensional price groups */ @JvmOverloads fun list( params: DimensionalPriceGroupListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 7cdb58bc..7c5125c5 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 @@ -23,9 +23,7 @@ import com.withorb.api.services.async.dimensionalPriceGroups.ExternalDimensional import java.util.concurrent.CompletableFuture class DimensionalPriceGroupServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : DimensionalPriceGroupServiceAsync { +internal constructor(private val clientOptions: ClientOptions) : DimensionalPriceGroupServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -51,7 +49,7 @@ internal constructor( */ override fun create( params: DimensionalPriceGroupCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -79,7 +77,7 @@ internal constructor( /** Fetch dimensional price group */ override fun retrieve( params: DimensionalPriceGroupRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -107,7 +105,7 @@ internal constructor( /** List dimensional price groups */ override fun list( params: DimensionalPriceGroupListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 8375f25c..b4f59789 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 @@ -67,7 +67,7 @@ interface EventServiceAsync { @JvmOverloads fun update( params: EventUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -109,7 +109,7 @@ interface EventServiceAsync { @JvmOverloads fun deprecate( params: EventDeprecateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -304,7 +304,7 @@ interface EventServiceAsync { @JvmOverloads fun ingest( params: EventIngestParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -326,6 +326,6 @@ interface EventServiceAsync { @JvmOverloads fun search( params: EventSearchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 34d9e506..96c440eb 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 @@ -27,10 +27,8 @@ import com.withorb.api.services.async.events.VolumeServiceAsync import com.withorb.api.services.async.events.VolumeServiceAsyncImpl import java.util.concurrent.CompletableFuture -class EventServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : EventServiceAsync { +class EventServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + EventServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -88,7 +86,7 @@ internal constructor( */ override fun update( params: EventUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -151,7 +149,7 @@ internal constructor( */ override fun deprecate( params: EventDeprecateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -367,7 +365,7 @@ internal constructor( */ override fun ingest( params: EventIngestParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -410,7 +408,7 @@ internal constructor( */ override fun search( params: EventSearchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsync.kt index caf2cc09..36556e2d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsync.kt @@ -18,6 +18,6 @@ interface InvoiceLineItemServiceAsync { @JvmOverloads fun create( params: InvoiceLineItemCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsyncImpl.kt index 964ae2df..2640414a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsyncImpl.kt @@ -18,9 +18,7 @@ import com.withorb.api.models.InvoiceLineItemCreateResponse import java.util.concurrent.CompletableFuture class InvoiceLineItemServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : InvoiceLineItemServiceAsync { +internal constructor(private val clientOptions: ClientOptions) : InvoiceLineItemServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -34,7 +32,7 @@ internal constructor( */ override fun create( params: InvoiceLineItemCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 8982ce8a..0821cec8 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 @@ -25,7 +25,7 @@ interface InvoiceServiceAsync { @JvmOverloads fun create( params: InvoiceCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -37,7 +37,7 @@ interface InvoiceServiceAsync { @JvmOverloads fun update( params: InvoiceUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -57,7 +57,7 @@ interface InvoiceServiceAsync { @JvmOverloads fun list( params: InvoiceListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -66,7 +66,7 @@ interface InvoiceServiceAsync { @JvmOverloads fun fetch( params: InvoiceFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -76,7 +76,7 @@ interface InvoiceServiceAsync { @JvmOverloads fun fetchUpcoming( params: InvoiceFetchUpcomingParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -89,7 +89,7 @@ interface InvoiceServiceAsync { @JvmOverloads fun issue( params: InvoiceIssueParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -99,7 +99,7 @@ interface InvoiceServiceAsync { @JvmOverloads fun markPaid( params: InvoiceMarkPaidParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -109,7 +109,7 @@ interface InvoiceServiceAsync { @JvmOverloads fun pay( params: InvoicePayParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -123,6 +123,6 @@ interface InvoiceServiceAsync { @JvmOverloads fun voidInvoice( params: InvoiceVoidInvoiceParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 32c2540a..0ad35b92 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 @@ -27,10 +27,8 @@ import com.withorb.api.models.InvoiceUpdateParams import com.withorb.api.models.InvoiceVoidInvoiceParams import java.util.concurrent.CompletableFuture -class InvoiceServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : InvoiceServiceAsync { +class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + InvoiceServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -40,7 +38,7 @@ internal constructor( /** This endpoint is used to create a one-off invoice for a customer. */ override fun create( params: InvoiceCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -73,7 +71,7 @@ internal constructor( */ override fun update( params: InvoiceUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -115,7 +113,7 @@ internal constructor( */ override fun list( params: InvoiceListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -145,7 +143,7 @@ internal constructor( */ override fun fetch( params: InvoiceFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -176,7 +174,7 @@ internal constructor( */ override fun fetchUpcoming( params: InvoiceFetchUpcomingParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -209,7 +207,7 @@ internal constructor( */ override fun issue( params: InvoiceIssueParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -240,7 +238,7 @@ internal constructor( */ override fun markPaid( params: InvoiceMarkPaidParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -271,7 +269,7 @@ internal constructor( */ override fun pay( params: InvoicePayParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -306,7 +304,7 @@ internal constructor( */ override fun voidInvoice( params: InvoiceVoidInvoiceParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 c2fd2e75..03e103a7 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 @@ -19,27 +19,27 @@ interface ItemServiceAsync { @JvmOverloads fun create( params: ItemCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** This endpoint can be used to update properties on the Item. */ @JvmOverloads fun update( params: ItemUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** This endpoint returns a list of all Items, ordered in descending order by creation time. */ @JvmOverloads fun list( params: ItemListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** This endpoint returns an item identified by its item_id. */ @JvmOverloads fun fetch( params: ItemFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 47ec5f4c..4025ad34 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 @@ -21,10 +21,8 @@ import com.withorb.api.models.ItemListParams import com.withorb.api.models.ItemUpdateParams import java.util.concurrent.CompletableFuture -class ItemServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ItemServiceAsync { +class ItemServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + ItemServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -34,7 +32,7 @@ internal constructor( /** This endpoint is used to create an [Item](/core-concepts#item). */ override fun create( params: ItemCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -62,7 +60,7 @@ internal constructor( /** This endpoint can be used to update properties on the Item. */ override fun update( params: ItemUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -91,7 +89,7 @@ internal constructor( /** This endpoint returns a list of all Items, ordered in descending order by creation time. */ override fun list( params: ItemListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -119,7 +117,7 @@ internal constructor( /** This endpoint returns an item identified by its item_id. */ override fun fetch( params: ItemFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 aa08c06b..ca4979d8 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 @@ -23,7 +23,7 @@ interface MetricServiceAsync { @JvmOverloads fun create( params: MetricCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -33,7 +33,7 @@ interface MetricServiceAsync { @JvmOverloads fun update( params: MetricUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -44,7 +44,7 @@ interface MetricServiceAsync { @JvmOverloads fun list( params: MetricListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -54,6 +54,6 @@ interface MetricServiceAsync { @JvmOverloads fun fetch( params: MetricFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 5cfd632d..4e713bf6 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 @@ -21,10 +21,8 @@ import com.withorb.api.models.MetricListParams import com.withorb.api.models.MetricUpdateParams import java.util.concurrent.CompletableFuture -class MetricServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : MetricServiceAsync { +class MetricServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + MetricServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -38,7 +36,7 @@ internal constructor( */ override fun create( params: MetricCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -69,7 +67,7 @@ internal constructor( */ override fun update( params: MetricUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -102,7 +100,7 @@ internal constructor( */ override fun list( params: MetricListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -133,7 +131,7 @@ internal constructor( */ override fun fetch( params: MetricFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 1ca77ec5..413b398b 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 @@ -22,7 +22,7 @@ interface PlanServiceAsync { @JvmOverloads fun create( params: PlanCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -34,7 +34,7 @@ interface PlanServiceAsync { @JvmOverloads fun update( params: PlanUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -46,7 +46,7 @@ interface PlanServiceAsync { @JvmOverloads fun list( params: PlanListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -70,6 +70,6 @@ interface PlanServiceAsync { @JvmOverloads fun fetch( params: PlanFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 f9c9b341..71d70f3a 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 @@ -23,10 +23,8 @@ import com.withorb.api.services.async.plans.ExternalPlanIdServiceAsync import com.withorb.api.services.async.plans.ExternalPlanIdServiceAsyncImpl import java.util.concurrent.CompletableFuture -class PlanServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PlanServiceAsync { +class PlanServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + PlanServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -42,7 +40,7 @@ internal constructor( /** This endpoint allows creation of plans including their prices. */ override fun create( params: PlanCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -75,7 +73,7 @@ internal constructor( */ override fun update( params: PlanUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -109,7 +107,7 @@ internal constructor( */ override fun list( params: PlanListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -154,7 +152,7 @@ internal constructor( */ override fun fetch( params: PlanFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 5eac22c8..ef7d0d33 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 @@ -35,7 +35,7 @@ interface PriceServiceAsync { @JvmOverloads fun create( params: PriceCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -45,7 +45,7 @@ interface PriceServiceAsync { @JvmOverloads fun update( params: PriceUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -55,7 +55,7 @@ interface PriceServiceAsync { @JvmOverloads fun list( params: PriceListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -80,13 +80,13 @@ interface PriceServiceAsync { @JvmOverloads fun evaluate( params: PriceEvaluateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** This endpoint returns a price given an identifier. */ @JvmOverloads fun fetch( params: PriceFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 13f13a1d..062cebec 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 @@ -25,10 +25,8 @@ import com.withorb.api.services.async.prices.ExternalPriceIdServiceAsync import com.withorb.api.services.async.prices.ExternalPriceIdServiceAsyncImpl import java.util.concurrent.CompletableFuture -class PriceServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PriceServiceAsync { +class PriceServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + PriceServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -55,7 +53,7 @@ internal constructor( */ override fun create( params: PriceCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -86,7 +84,7 @@ internal constructor( */ override fun update( params: PriceUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -118,7 +116,7 @@ internal constructor( */ override fun list( params: PriceListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -164,7 +162,7 @@ internal constructor( */ override fun evaluate( params: PriceEvaluateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -192,7 +190,7 @@ internal constructor( /** This endpoint returns a price given an identifier. */ override fun fetch( params: PriceFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 bb496cdb..7e7e099e 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 @@ -281,7 +281,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun create( params: SubscriptionCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -291,7 +291,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun update( params: SubscriptionUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -307,7 +307,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun list( params: SubscriptionListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -366,7 +366,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun cancel( params: SubscriptionCancelParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -376,7 +376,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun fetch( params: SubscriptionFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -393,7 +393,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun fetchCosts( params: SubscriptionFetchCostsParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -404,7 +404,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun fetchSchedule( params: SubscriptionFetchScheduleParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -587,7 +587,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun fetchUsage( params: SubscriptionFetchUsageParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -660,7 +660,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun priceIntervals( params: SubscriptionPriceIntervalsParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -832,7 +832,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun schedulePlanChange( params: SubscriptionSchedulePlanChangeParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -841,7 +841,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun triggerPhase( params: SubscriptionTriggerPhaseParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -854,7 +854,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun unscheduleCancellation( params: SubscriptionUnscheduleCancellationParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -866,7 +866,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun unscheduleFixedFeeQuantityUpdates( params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -875,7 +875,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun unschedulePendingPlanChanges( params: SubscriptionUnschedulePendingPlanChangesParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -895,7 +895,7 @@ interface SubscriptionServiceAsync { @JvmOverloads fun updateFixedFeeQuantity( params: SubscriptionUpdateFixedFeeQuantityParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -919,6 +919,6 @@ interface SubscriptionServiceAsync { @JvmOverloads fun updateTrial( params: SubscriptionUpdateTrialParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): 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 8d84b666..beb771d2 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 @@ -46,10 +46,8 @@ import com.withorb.api.models.SubscriptionUpdateTrialResponse import com.withorb.api.models.SubscriptionUsage import java.util.concurrent.CompletableFuture -class SubscriptionServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : SubscriptionServiceAsync { +class SubscriptionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + SubscriptionServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -297,7 +295,7 @@ internal constructor( */ override fun create( params: SubscriptionCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -328,7 +326,7 @@ internal constructor( */ override fun update( params: SubscriptionUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -366,7 +364,7 @@ internal constructor( */ override fun list( params: SubscriptionListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -447,7 +445,7 @@ internal constructor( */ override fun cancel( params: SubscriptionCancelParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -478,7 +476,7 @@ internal constructor( */ override fun fetch( params: SubscriptionFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -516,7 +514,7 @@ internal constructor( */ override fun fetchCosts( params: SubscriptionFetchCostsParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -548,7 +546,7 @@ internal constructor( */ override fun fetchSchedule( params: SubscriptionFetchScheduleParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -752,7 +750,7 @@ internal constructor( */ override fun fetchUsage( params: SubscriptionFetchUsageParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -846,7 +844,7 @@ internal constructor( */ override fun priceIntervals( params: SubscriptionPriceIntervalsParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -1040,7 +1038,7 @@ internal constructor( */ override fun schedulePlanChange( params: SubscriptionSchedulePlanChangeParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -1071,7 +1069,7 @@ internal constructor( */ override fun triggerPhase( params: SubscriptionTriggerPhaseParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -1106,7 +1104,7 @@ internal constructor( */ override fun unscheduleCancellation( params: SubscriptionUnscheduleCancellationParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -1141,7 +1139,7 @@ internal constructor( */ override fun unscheduleFixedFeeQuantityUpdates( params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -1149,7 +1147,7 @@ internal constructor( .addPathSegments( "subscriptions", params.getPathParam(0), - "unschedule_fixed_fee_quantity_updates" + "unschedule_fixed_fee_quantity_updates", ) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -1177,7 +1175,7 @@ internal constructor( */ override fun unschedulePendingPlanChanges( params: SubscriptionUnschedulePendingPlanChangesParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -1185,7 +1183,7 @@ internal constructor( .addPathSegments( "subscriptions", params.getPathParam(0), - "unschedule_pending_plan_changes" + "unschedule_pending_plan_changes", ) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -1223,7 +1221,7 @@ internal constructor( */ override fun updateFixedFeeQuantity( params: SubscriptionUpdateFixedFeeQuantityParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -1231,7 +1229,7 @@ internal constructor( .addPathSegments( "subscriptions", params.getPathParam(0), - "update_fixed_fee_quantity" + "update_fixed_fee_quantity", ) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -1273,7 +1271,7 @@ internal constructor( */ override fun updateTrial( params: SubscriptionUpdateTrialParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/TopLevelServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/TopLevelServiceAsync.kt index 56f8ff00..fc2e3f98 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/TopLevelServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/TopLevelServiceAsync.kt @@ -22,6 +22,6 @@ interface TopLevelServiceAsync { @JvmOverloads fun ping( params: TopLevelPingParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/TopLevelServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/TopLevelServiceAsyncImpl.kt index b67034b3..2989fe7c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/TopLevelServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/TopLevelServiceAsyncImpl.kt @@ -16,10 +16,8 @@ import com.withorb.api.models.TopLevelPingParams import com.withorb.api.models.TopLevelPingResponse import java.util.concurrent.CompletableFuture -class TopLevelServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : TopLevelServiceAsync { +class TopLevelServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + TopLevelServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -36,7 +34,7 @@ internal constructor( */ override fun ping( params: TopLevelPingParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 da626b9b..2824b898 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 @@ -20,6 +20,6 @@ interface SubscriptionServiceAsync { @JvmOverloads fun list( params: CouponSubscriptionListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 5c115e01..db939178 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 @@ -16,10 +16,8 @@ import com.withorb.api.models.CouponSubscriptionListPageAsync import com.withorb.api.models.CouponSubscriptionListParams import java.util.concurrent.CompletableFuture -class SubscriptionServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : SubscriptionServiceAsync { +class SubscriptionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + SubscriptionServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -35,7 +33,7 @@ internal constructor( */ override fun list( params: CouponSubscriptionListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 76ddf63c..8486da2b 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 @@ -20,7 +20,7 @@ interface BalanceTransactionServiceAsync { @JvmOverloads fun create( params: CustomerBalanceTransactionCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -53,6 +53,6 @@ interface BalanceTransactionServiceAsync { @JvmOverloads fun list( params: CustomerBalanceTransactionListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 6030bd66..52545b34 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 @@ -20,9 +20,7 @@ import com.withorb.api.models.CustomerBalanceTransactionListParams import java.util.concurrent.CompletableFuture class BalanceTransactionServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : BalanceTransactionServiceAsync { +internal constructor(private val clientOptions: ClientOptions) : BalanceTransactionServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -36,7 +34,7 @@ internal constructor( */ override fun create( params: CustomerBalanceTransactionCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -91,7 +89,7 @@ internal constructor( */ override fun list( params: CustomerBalanceTransactionListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 56b301d8..151a5c89 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 @@ -126,7 +126,7 @@ interface CostServiceAsync { @JvmOverloads fun list( params: CustomerCostListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -242,6 +242,6 @@ interface CostServiceAsync { @JvmOverloads fun listByExternalId( params: CustomerCostListByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 a0491360..4424202f 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 @@ -18,10 +18,8 @@ import com.withorb.api.models.CustomerCostListParams import com.withorb.api.models.CustomerCostListResponse import java.util.concurrent.CompletableFuture -class CostServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CostServiceAsync { +class CostServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + CostServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -141,7 +139,7 @@ internal constructor( */ override fun list( params: CustomerCostListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -278,7 +276,7 @@ internal constructor( */ override fun listByExternalId( params: CustomerCostListByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -287,7 +285,7 @@ internal constructor( "customers", "external_customer_id", params.getPathParam(0), - "costs" + "costs", ) .build() .prepareAsync(clientOptions, params) 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 06b18043..29ed966b 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 @@ -31,7 +31,7 @@ interface CreditServiceAsync { @JvmOverloads fun list( params: CustomerCreditListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -46,6 +46,6 @@ interface CreditServiceAsync { @JvmOverloads fun listByExternalId( params: CustomerCreditListByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 4fb0e2b4..3a3adfd6 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 @@ -22,10 +22,8 @@ import com.withorb.api.services.async.customers.credits.TopUpServiceAsync import com.withorb.api.services.async.customers.credits.TopUpServiceAsyncImpl import java.util.concurrent.CompletableFuture -class CreditServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CreditServiceAsync { +class CreditServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + CreditServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -52,7 +50,7 @@ internal constructor( */ override fun list( params: CustomerCreditListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -89,7 +87,7 @@ internal constructor( */ override fun listByExternalId( params: CustomerCreditListByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -98,7 +96,7 @@ internal constructor( "customers", "external_customer_id", params.getPathParam(0), - "credits" + "credits", ) .build() .prepareAsync(clientOptions, params) 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 d006d91e..4eb5913a 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 @@ -99,7 +99,7 @@ interface LedgerServiceAsync { @JvmOverloads fun list( params: CustomerCreditLedgerListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -208,7 +208,7 @@ interface LedgerServiceAsync { @JvmOverloads fun createEntry( params: CustomerCreditLedgerCreateEntryParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -317,7 +317,7 @@ interface LedgerServiceAsync { @JvmOverloads fun createEntryByExternalId( params: CustomerCreditLedgerCreateEntryByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -402,6 +402,6 @@ interface LedgerServiceAsync { @JvmOverloads fun listByExternalId( params: CustomerCreditLedgerListByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 329657cc..9024b478 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 @@ -23,10 +23,8 @@ import com.withorb.api.models.CustomerCreditLedgerListPageAsync import com.withorb.api.models.CustomerCreditLedgerListParams import java.util.concurrent.CompletableFuture -class LedgerServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : LedgerServiceAsync { +class LedgerServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + LedgerServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -115,7 +113,7 @@ internal constructor( */ override fun list( params: CustomerCreditLedgerListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -246,7 +244,7 @@ internal constructor( */ override fun createEntry( params: CustomerCreditLedgerCreateEntryParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -378,7 +376,7 @@ internal constructor( */ override fun createEntryByExternalId( params: CustomerCreditLedgerCreateEntryByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -388,7 +386,7 @@ internal constructor( "external_customer_id", params.getPathParam(0), "credits", - "ledger_entry" + "ledger_entry", ) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -494,7 +492,7 @@ internal constructor( */ override fun listByExternalId( params: CustomerCreditLedgerListByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -504,7 +502,7 @@ internal constructor( "external_customer_id", params.getPathParam(0), "credits", - "ledger" + "ledger", ) .build() .prepareAsync(clientOptions, params) 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 3479ca07..d3ba0a7b 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 @@ -30,21 +30,21 @@ interface TopUpServiceAsync { @JvmOverloads fun create( params: CustomerCreditTopUpCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** List top-ups */ @JvmOverloads fun list( params: CustomerCreditTopUpListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Delete top-up */ @JvmOverloads fun delete( params: CustomerCreditTopUpDeleteParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -58,20 +58,20 @@ interface TopUpServiceAsync { @JvmOverloads fun createByExternalId( params: CustomerCreditTopUpCreateByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Delete top-up by external ID */ @JvmOverloads fun deleteByExternalId( params: CustomerCreditTopUpDeleteByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** List top-ups by external ID */ @JvmOverloads fun listByExternalId( params: CustomerCreditTopUpListByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 cd4d4e1d..2356bff1 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 @@ -26,10 +26,8 @@ import com.withorb.api.models.CustomerCreditTopUpListPageAsync import com.withorb.api.models.CustomerCreditTopUpListParams import java.util.concurrent.CompletableFuture -class TopUpServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : TopUpServiceAsync { +class TopUpServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + TopUpServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -47,7 +45,7 @@ internal constructor( */ override fun create( params: CustomerCreditTopUpCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -76,7 +74,7 @@ internal constructor( /** List top-ups */ override fun list( params: CustomerCreditTopUpListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -103,7 +101,7 @@ internal constructor( /** Delete top-up */ override fun delete( params: CustomerCreditTopUpDeleteParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -113,7 +111,7 @@ internal constructor( params.getPathParam(0), "credits", "top_ups", - params.getPathParam(1) + params.getPathParam(1), ) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -137,7 +135,7 @@ internal constructor( */ override fun createByExternalId( params: CustomerCreditTopUpCreateByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -147,7 +145,7 @@ internal constructor( "external_customer_id", params.getPathParam(0), "credits", - "top_ups" + "top_ups", ) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -171,7 +169,7 @@ internal constructor( /** Delete top-up by external ID */ override fun deleteByExternalId( params: CustomerCreditTopUpDeleteByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -182,7 +180,7 @@ internal constructor( params.getPathParam(0), "credits", "top_ups", - params.getPathParam(1) + params.getPathParam(1), ) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -200,7 +198,7 @@ internal constructor( /** List top-ups by external ID */ override fun listByExternalId( params: CustomerCreditTopUpListByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -210,7 +208,7 @@ internal constructor( "external_customer_id", params.getPathParam(0), "credits", - "top_ups" + "top_ups", ) .build() .prepareAsync(clientOptions, params) 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 62df29ca..42253639 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 @@ -15,6 +15,6 @@ interface ExternalDimensionalPriceGroupIdServiceAsync { @JvmOverloads fun retrieve( params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 9c5e6e9d..74ba9749 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 @@ -17,9 +17,8 @@ import com.withorb.api.models.DimensionalPriceGroupExternalDimensionalPriceGroup import java.util.concurrent.CompletableFuture class ExternalDimensionalPriceGroupIdServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ExternalDimensionalPriceGroupIdServiceAsync { +internal constructor(private val clientOptions: ClientOptions) : + ExternalDimensionalPriceGroupIdServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -29,7 +28,7 @@ internal constructor( /** Fetch dimensional price group by external ID */ override fun retrieve( params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -37,7 +36,7 @@ internal constructor( .addPathSegments( "dimensional_price_groups", "external_dimensional_price_group_id", - params.getPathParam(0) + params.getPathParam(0), ) .build() .prepareAsync(clientOptions, params) 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 1848f302..adcdd282 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 @@ -52,7 +52,7 @@ interface BackfillServiceAsync { @JvmOverloads fun create( params: EventBackfillCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -66,7 +66,7 @@ interface BackfillServiceAsync { @JvmOverloads fun list( params: EventBackfillListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -77,14 +77,14 @@ interface BackfillServiceAsync { @JvmOverloads fun close( params: EventBackfillCloseParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** This endpoint is used to fetch a backfill given an identifier. */ @JvmOverloads fun fetch( params: EventBackfillFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -98,6 +98,6 @@ interface BackfillServiceAsync { @JvmOverloads fun revert( params: EventBackfillRevertParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 cdfb8755..35bf790e 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 @@ -25,10 +25,8 @@ import com.withorb.api.models.EventBackfillRevertParams import com.withorb.api.models.EventBackfillRevertResponse import java.util.concurrent.CompletableFuture -class BackfillServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : BackfillServiceAsync { +class BackfillServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + BackfillServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -68,7 +66,7 @@ internal constructor( */ override fun create( params: EventBackfillCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -104,7 +102,7 @@ internal constructor( */ override fun list( params: EventBackfillListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -137,7 +135,7 @@ internal constructor( */ override fun close( params: EventBackfillCloseParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -166,7 +164,7 @@ internal constructor( /** This endpoint is used to fetch a backfill given an identifier. */ override fun fetch( params: EventBackfillFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -201,7 +199,7 @@ internal constructor( */ override fun revert( params: EventBackfillRevertParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/VolumeServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/VolumeServiceAsync.kt index d48f5210..bcbf29ec 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/VolumeServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/VolumeServiceAsync.kt @@ -27,6 +27,6 @@ interface VolumeServiceAsync { @JvmOverloads fun list( params: EventVolumeListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/VolumeServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/VolumeServiceAsyncImpl.kt index 69349f66..024cbdd5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/VolumeServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/events/VolumeServiceAsyncImpl.kt @@ -16,10 +16,8 @@ import com.withorb.api.models.EventVolumeListParams import com.withorb.api.models.EventVolumes import java.util.concurrent.CompletableFuture -class VolumeServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : VolumeServiceAsync { +class VolumeServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + VolumeServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -41,7 +39,7 @@ internal constructor( */ override fun list( params: EventVolumeListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 fdc8346b..ae4720f9 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 @@ -21,7 +21,7 @@ interface ExternalPlanIdServiceAsync { @JvmOverloads fun update( params: PlanExternalPlanIdUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -44,6 +44,6 @@ interface ExternalPlanIdServiceAsync { @JvmOverloads fun fetch( params: PlanExternalPlanIdFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 0befd73f..cd485e5e 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 @@ -19,9 +19,7 @@ import com.withorb.api.models.PlanExternalPlanIdUpdateParams import java.util.concurrent.CompletableFuture class ExternalPlanIdServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ExternalPlanIdServiceAsync { +internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -36,7 +34,7 @@ internal constructor( */ override fun update( params: PlanExternalPlanIdUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -80,7 +78,7 @@ internal constructor( */ override fun fetch( params: PlanExternalPlanIdFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 d1335b78..f26f1cfd 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 @@ -19,7 +19,7 @@ interface ExternalPriceIdServiceAsync { @JvmOverloads fun update( params: PriceExternalPriceIdUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -30,6 +30,6 @@ interface ExternalPriceIdServiceAsync { @JvmOverloads fun fetch( params: PriceExternalPriceIdFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } 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 77919d9e..9c4db82e 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 @@ -19,9 +19,7 @@ import com.withorb.api.models.PriceExternalPriceIdUpdateParams import java.util.concurrent.CompletableFuture class ExternalPriceIdServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ExternalPriceIdServiceAsync { +internal constructor(private val clientOptions: ClientOptions) : ExternalPriceIdServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -34,7 +32,7 @@ internal constructor( */ override fun update( params: PriceExternalPriceIdUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -66,7 +64,7 @@ internal constructor( */ override fun fetch( params: PriceExternalPriceIdFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() 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 05bfae6c..d68ad39f 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 @@ -22,14 +22,14 @@ interface AlertService { @JvmOverloads fun retrieve( params: AlertRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Alert /** This endpoint updates the thresholds of an alert. */ @JvmOverloads fun update( params: AlertUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Alert /** @@ -46,7 +46,7 @@ interface AlertService { @JvmOverloads fun list( params: AlertListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): AlertListPage /** @@ -60,7 +60,7 @@ interface AlertService { @JvmOverloads fun createForCustomer( params: AlertCreateForCustomerParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Alert /** @@ -74,7 +74,7 @@ interface AlertService { @JvmOverloads fun createForExternalCustomer( params: AlertCreateForExternalCustomerParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Alert /** @@ -92,7 +92,7 @@ interface AlertService { @JvmOverloads fun createForSubscription( params: AlertCreateForSubscriptionParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Alert /** @@ -103,7 +103,7 @@ interface AlertService { @JvmOverloads fun disable( params: AlertDisableParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Alert /** @@ -114,6 +114,6 @@ interface AlertService { @JvmOverloads fun enable( params: AlertEnableParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Alert } 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 a8d09f66..ff748230 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 @@ -24,10 +24,8 @@ import com.withorb.api.models.AlertListParams import com.withorb.api.models.AlertRetrieveParams import com.withorb.api.models.AlertUpdateParams -class AlertServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : AlertService { +class AlertServiceImpl internal constructor(private val clientOptions: ClientOptions) : + AlertService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -119,7 +117,7 @@ internal constructor( */ override fun createForCustomer( params: AlertCreateForCustomerParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Alert { val request = HttpRequest.builder() @@ -151,7 +149,7 @@ internal constructor( */ override fun createForExternalCustomer( params: AlertCreateForExternalCustomerParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Alert { val request = HttpRequest.builder() @@ -187,7 +185,7 @@ internal constructor( */ override fun createForSubscription( params: AlertCreateForSubscriptionParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Alert { val request = HttpRequest.builder() 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 145a1848..a30a2f7e 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 @@ -24,7 +24,7 @@ interface CouponService { @JvmOverloads fun create( params: CouponCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Coupon /** @@ -38,7 +38,7 @@ interface CouponService { @JvmOverloads fun list( params: CouponListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CouponListPage /** @@ -49,7 +49,7 @@ interface CouponService { @JvmOverloads fun archive( params: CouponArchiveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Coupon /** @@ -59,6 +59,6 @@ interface CouponService { @JvmOverloads fun fetch( params: CouponFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Coupon } 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 cf34895b..e5f394b3 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 @@ -22,10 +22,8 @@ import com.withorb.api.models.CouponListParams import com.withorb.api.services.blocking.coupons.SubscriptionService import com.withorb.api.services.blocking.coupons.SubscriptionServiceImpl -class CouponServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CouponService { +class CouponServiceImpl internal constructor(private val clientOptions: ClientOptions) : + CouponService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) 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 938cd213..bed98947 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 @@ -17,7 +17,7 @@ interface CreditNoteService { @JvmOverloads fun create( params: CreditNoteCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CreditNote /** @@ -28,7 +28,7 @@ interface CreditNoteService { @JvmOverloads fun list( params: CreditNoteListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CreditNoteListPage /** @@ -38,6 +38,6 @@ interface CreditNoteService { @JvmOverloads fun fetch( params: CreditNoteFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CreditNote } 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 81cdfd05..9affdd09 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 @@ -19,10 +19,8 @@ import com.withorb.api.models.CreditNoteFetchParams import com.withorb.api.models.CreditNoteListPage import com.withorb.api.models.CreditNoteListParams -class CreditNoteServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CreditNoteService { +class CreditNoteServiceImpl internal constructor(private val clientOptions: ClientOptions) : + CreditNoteService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -32,7 +30,7 @@ internal constructor( /** This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). */ override fun create( params: CreditNoteCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CreditNote { val request = HttpRequest.builder() @@ -62,7 +60,7 @@ internal constructor( */ override fun list( params: CreditNoteListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CreditNoteListPage { val request = HttpRequest.builder() 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 972c3656..1fa09fed 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 @@ -44,7 +44,7 @@ interface CustomerService { @JvmOverloads fun create( params: CustomerCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Customer /** @@ -56,7 +56,7 @@ interface CustomerService { @JvmOverloads fun update( params: CustomerUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Customer /** @@ -69,7 +69,7 @@ interface CustomerService { @JvmOverloads fun list( params: CustomerListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerListPage /** @@ -100,7 +100,7 @@ interface CustomerService { @JvmOverloads fun fetch( params: CustomerFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Customer /** @@ -113,7 +113,7 @@ interface CustomerService { @JvmOverloads fun fetchByExternalId( params: CustomerFetchByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Customer /** @@ -127,7 +127,7 @@ interface CustomerService { @JvmOverloads fun syncPaymentMethodsFromGateway( params: CustomerSyncPaymentMethodsFromGatewayParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ) /** @@ -141,7 +141,7 @@ interface CustomerService { @JvmOverloads fun syncPaymentMethodsFromGatewayByExternalCustomerId( params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ) /** @@ -152,6 +152,6 @@ interface CustomerService { @JvmOverloads fun updateByExternalId( params: CustomerUpdateByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Customer } 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 9133a4e6..bafad84e 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 @@ -32,10 +32,8 @@ import com.withorb.api.services.blocking.customers.CostServiceImpl import com.withorb.api.services.blocking.customers.CreditService import com.withorb.api.services.blocking.customers.CreditServiceImpl -class CustomerServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CustomerService { +class CustomerServiceImpl internal constructor(private val clientOptions: ClientOptions) : + CustomerService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -127,7 +125,7 @@ internal constructor( */ override fun list( params: CustomerListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerListPage { val request = HttpRequest.builder() @@ -214,7 +212,7 @@ internal constructor( */ override fun fetchByExternalId( params: CustomerFetchByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Customer { val request = HttpRequest.builder() @@ -245,7 +243,7 @@ internal constructor( */ override fun syncPaymentMethodsFromGateway( params: CustomerSyncPaymentMethodsFromGatewayParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ) { val request = HttpRequest.builder() @@ -254,7 +252,7 @@ internal constructor( "customers", "external_customer_id", params.getPathParam(0), - "sync_payment_methods_from_gateway" + "sync_payment_methods_from_gateway", ) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -276,7 +274,7 @@ internal constructor( */ override fun syncPaymentMethodsFromGatewayByExternalCustomerId( params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ) { val request = HttpRequest.builder() @@ -284,7 +282,7 @@ internal constructor( .addPathSegments( "customers", params.getPathParam(0), - "sync_payment_methods_from_gateway" + "sync_payment_methods_from_gateway", ) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -303,7 +301,7 @@ internal constructor( */ override fun updateByExternalId( params: CustomerUpdateByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Customer { val request = HttpRequest.builder() 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 72430c8d..c1c8eb00 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 @@ -28,20 +28,20 @@ interface DimensionalPriceGroupService { @JvmOverloads fun create( params: DimensionalPriceGroupCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): DimensionalPriceGroup /** Fetch dimensional price group */ @JvmOverloads fun retrieve( params: DimensionalPriceGroupRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): DimensionalPriceGroup /** List dimensional price groups */ @JvmOverloads fun list( params: DimensionalPriceGroupListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): DimensionalPriceGroupListPage } 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 44ba4dfb..9f2a7418 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 @@ -22,9 +22,7 @@ import com.withorb.api.services.blocking.dimensionalPriceGroups.ExternalDimensio import com.withorb.api.services.blocking.dimensionalPriceGroups.ExternalDimensionalPriceGroupIdServiceImpl class DimensionalPriceGroupServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : DimensionalPriceGroupService { +internal constructor(private val clientOptions: ClientOptions) : DimensionalPriceGroupService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -49,7 +47,7 @@ internal constructor( */ override fun create( params: DimensionalPriceGroupCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): DimensionalPriceGroup { val request = HttpRequest.builder() @@ -74,7 +72,7 @@ internal constructor( /** Fetch dimensional price group */ override fun retrieve( params: DimensionalPriceGroupRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): DimensionalPriceGroup { val request = HttpRequest.builder() @@ -99,7 +97,7 @@ internal constructor( /** List dimensional price groups */ override fun list( params: DimensionalPriceGroupListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): DimensionalPriceGroupListPage { val request = HttpRequest.builder() 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 b8283b72..ab23d7a1 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 @@ -66,7 +66,7 @@ interface EventService { @JvmOverloads fun update( params: EventUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): EventUpdateResponse /** @@ -108,7 +108,7 @@ interface EventService { @JvmOverloads fun deprecate( params: EventDeprecateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): EventDeprecateResponse /** @@ -303,7 +303,7 @@ interface EventService { @JvmOverloads fun ingest( params: EventIngestParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): EventIngestResponse /** @@ -325,6 +325,6 @@ interface EventService { @JvmOverloads fun search( params: EventSearchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): EventSearchResponse } 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 a64b872f..47550d3b 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 @@ -26,10 +26,8 @@ import com.withorb.api.services.blocking.events.BackfillServiceImpl import com.withorb.api.services.blocking.events.VolumeService import com.withorb.api.services.blocking.events.VolumeServiceImpl -class EventServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : EventService { +class EventServiceImpl internal constructor(private val clientOptions: ClientOptions) : + EventService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -87,7 +85,7 @@ internal constructor( */ override fun update( params: EventUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): EventUpdateResponse { val request = HttpRequest.builder() @@ -147,7 +145,7 @@ internal constructor( */ override fun deprecate( params: EventDeprecateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): EventDeprecateResponse { val request = HttpRequest.builder() @@ -360,7 +358,7 @@ internal constructor( */ override fun ingest( params: EventIngestParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): EventIngestResponse { val request = HttpRequest.builder() @@ -400,7 +398,7 @@ internal constructor( */ override fun search( params: EventSearchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): EventSearchResponse { val request = HttpRequest.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceLineItemService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceLineItemService.kt index 0627413c..6ad07bb1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceLineItemService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceLineItemService.kt @@ -17,6 +17,6 @@ interface InvoiceLineItemService { @JvmOverloads fun create( params: InvoiceLineItemCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): InvoiceLineItemCreateResponse } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceLineItemServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceLineItemServiceImpl.kt index 84a622f4..f42976fe 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceLineItemServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceLineItemServiceImpl.kt @@ -16,10 +16,8 @@ import com.withorb.api.errors.OrbError import com.withorb.api.models.InvoiceLineItemCreateParams import com.withorb.api.models.InvoiceLineItemCreateResponse -class InvoiceLineItemServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : InvoiceLineItemService { +class InvoiceLineItemServiceImpl internal constructor(private val clientOptions: ClientOptions) : + InvoiceLineItemService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -33,7 +31,7 @@ internal constructor( */ override fun create( params: InvoiceLineItemCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): InvoiceLineItemCreateResponse { val request = HttpRequest.builder() 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 e317889a..c17dbb49 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 @@ -24,7 +24,7 @@ interface InvoiceService { @JvmOverloads fun create( params: InvoiceCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Invoice /** @@ -36,7 +36,7 @@ interface InvoiceService { @JvmOverloads fun update( params: InvoiceUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Invoice /** @@ -56,7 +56,7 @@ interface InvoiceService { @JvmOverloads fun list( params: InvoiceListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): InvoiceListPage /** @@ -65,7 +65,7 @@ interface InvoiceService { @JvmOverloads fun fetch( params: InvoiceFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Invoice /** @@ -75,7 +75,7 @@ interface InvoiceService { @JvmOverloads fun fetchUpcoming( params: InvoiceFetchUpcomingParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): InvoiceFetchUpcomingResponse /** @@ -88,7 +88,7 @@ interface InvoiceService { @JvmOverloads fun issue( params: InvoiceIssueParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Invoice /** @@ -98,7 +98,7 @@ interface InvoiceService { @JvmOverloads fun markPaid( params: InvoiceMarkPaidParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Invoice /** @@ -108,7 +108,7 @@ interface InvoiceService { @JvmOverloads fun pay( params: InvoicePayParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Invoice /** @@ -122,6 +122,6 @@ interface InvoiceService { @JvmOverloads fun voidInvoice( params: InvoiceVoidInvoiceParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Invoice } 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 5787b7da..a70e5c69 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 @@ -26,10 +26,8 @@ import com.withorb.api.models.InvoicePayParams import com.withorb.api.models.InvoiceUpdateParams import com.withorb.api.models.InvoiceVoidInvoiceParams -class InvoiceServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : InvoiceService { +class InvoiceServiceImpl internal constructor(private val clientOptions: ClientOptions) : + InvoiceService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -151,7 +149,7 @@ internal constructor( */ override fun fetchUpcoming( params: InvoiceFetchUpcomingParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): InvoiceFetchUpcomingResponse { val request = HttpRequest.builder() @@ -260,7 +258,7 @@ internal constructor( */ override fun voidInvoice( params: InvoiceVoidInvoiceParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Invoice { val request = HttpRequest.builder() 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 bc1e8e86..1a5e4133 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 @@ -18,21 +18,21 @@ interface ItemService { @JvmOverloads fun create( params: ItemCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Item /** This endpoint can be used to update properties on the Item. */ @JvmOverloads fun update( params: ItemUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Item /** This endpoint returns a list of all Items, ordered in descending order by creation time. */ @JvmOverloads fun list( params: ItemListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): ItemListPage /** This endpoint returns an item identified by its item_id. */ 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 212287b2..0f2a9898 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 @@ -20,10 +20,7 @@ import com.withorb.api.models.ItemListPage import com.withorb.api.models.ItemListParams import com.withorb.api.models.ItemUpdateParams -class ItemServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ItemService { +class ItemServiceImpl internal constructor(private val clientOptions: ClientOptions) : ItemService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) 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 80d5c03b..ddc540f5 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 @@ -22,7 +22,7 @@ interface MetricService { @JvmOverloads fun create( params: MetricCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): BillableMetric /** @@ -32,7 +32,7 @@ interface MetricService { @JvmOverloads fun update( params: MetricUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): BillableMetric /** @@ -43,7 +43,7 @@ interface MetricService { @JvmOverloads fun list( params: MetricListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): MetricListPage /** @@ -53,6 +53,6 @@ interface MetricService { @JvmOverloads fun fetch( params: MetricFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): BillableMetric } 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 6a34472b..b9fe248f 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 @@ -20,10 +20,8 @@ import com.withorb.api.models.MetricListPage import com.withorb.api.models.MetricListParams import com.withorb.api.models.MetricUpdateParams -class MetricServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : MetricService { +class MetricServiceImpl internal constructor(private val clientOptions: ClientOptions) : + MetricService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -37,7 +35,7 @@ internal constructor( */ override fun create( params: MetricCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): BillableMetric { val request = HttpRequest.builder() @@ -65,7 +63,7 @@ internal constructor( */ override fun update( params: MetricUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): BillableMetric { val request = HttpRequest.builder() 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 9818cf73..a28dd6be 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 @@ -21,7 +21,7 @@ interface PlanService { @JvmOverloads fun create( params: PlanCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Plan /** @@ -33,7 +33,7 @@ interface PlanService { @JvmOverloads fun update( params: PlanUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Plan /** @@ -45,7 +45,7 @@ interface PlanService { @JvmOverloads fun list( params: PlanListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): PlanListPage /** 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 4cce89a5..f5fd96a8 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 @@ -22,10 +22,7 @@ import com.withorb.api.models.PlanUpdateParams import com.withorb.api.services.blocking.plans.ExternalPlanIdService import com.withorb.api.services.blocking.plans.ExternalPlanIdServiceImpl -class PlanServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PlanService { +class PlanServiceImpl internal constructor(private val clientOptions: ClientOptions) : PlanService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) 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 08ca5db0..4f62938b 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 @@ -34,7 +34,7 @@ interface PriceService { @JvmOverloads fun create( params: PriceCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Price /** @@ -44,7 +44,7 @@ interface PriceService { @JvmOverloads fun update( params: PriceUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Price /** @@ -54,7 +54,7 @@ interface PriceService { @JvmOverloads fun list( params: PriceListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): PriceListPage /** @@ -79,13 +79,13 @@ interface PriceService { @JvmOverloads fun evaluate( params: PriceEvaluateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): PriceEvaluateResponse /** This endpoint returns a price given an identifier. */ @JvmOverloads fun fetch( params: PriceFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Price } 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 3197f34a..a7bb4269 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 @@ -24,10 +24,8 @@ import com.withorb.api.models.PriceUpdateParams import com.withorb.api.services.blocking.prices.ExternalPriceIdService import com.withorb.api.services.blocking.prices.ExternalPriceIdServiceImpl -class PriceServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PriceService { +class PriceServiceImpl internal constructor(private val clientOptions: ClientOptions) : + PriceService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -144,7 +142,7 @@ internal constructor( */ override fun evaluate( params: PriceEvaluateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): PriceEvaluateResponse { val request = HttpRequest.builder() 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 1f859551..0ba510ed 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 @@ -280,7 +280,7 @@ interface SubscriptionService { @JvmOverloads fun create( params: SubscriptionCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionCreateResponse /** @@ -290,7 +290,7 @@ interface SubscriptionService { @JvmOverloads fun update( params: SubscriptionUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Subscription /** @@ -306,7 +306,7 @@ interface SubscriptionService { @JvmOverloads fun list( params: SubscriptionListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionListPage /** @@ -365,7 +365,7 @@ interface SubscriptionService { @JvmOverloads fun cancel( params: SubscriptionCancelParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionCancelResponse /** @@ -375,7 +375,7 @@ interface SubscriptionService { @JvmOverloads fun fetch( params: SubscriptionFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Subscription /** @@ -392,7 +392,7 @@ interface SubscriptionService { @JvmOverloads fun fetchCosts( params: SubscriptionFetchCostsParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionFetchCostsResponse /** @@ -403,7 +403,7 @@ interface SubscriptionService { @JvmOverloads fun fetchSchedule( params: SubscriptionFetchScheduleParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionFetchSchedulePage /** @@ -586,7 +586,7 @@ interface SubscriptionService { @JvmOverloads fun fetchUsage( params: SubscriptionFetchUsageParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionUsage /** @@ -659,7 +659,7 @@ interface SubscriptionService { @JvmOverloads fun priceIntervals( params: SubscriptionPriceIntervalsParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionPriceIntervalsResponse /** @@ -831,7 +831,7 @@ interface SubscriptionService { @JvmOverloads fun schedulePlanChange( params: SubscriptionSchedulePlanChangeParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionSchedulePlanChangeResponse /** @@ -840,7 +840,7 @@ interface SubscriptionService { @JvmOverloads fun triggerPhase( params: SubscriptionTriggerPhaseParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionTriggerPhaseResponse /** @@ -853,7 +853,7 @@ interface SubscriptionService { @JvmOverloads fun unscheduleCancellation( params: SubscriptionUnscheduleCancellationParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionUnscheduleCancellationResponse /** @@ -865,7 +865,7 @@ interface SubscriptionService { @JvmOverloads fun unscheduleFixedFeeQuantityUpdates( params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse /** @@ -874,7 +874,7 @@ interface SubscriptionService { @JvmOverloads fun unschedulePendingPlanChanges( params: SubscriptionUnschedulePendingPlanChangesParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionUnschedulePendingPlanChangesResponse /** @@ -894,7 +894,7 @@ interface SubscriptionService { @JvmOverloads fun updateFixedFeeQuantity( params: SubscriptionUpdateFixedFeeQuantityParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionUpdateFixedFeeQuantityResponse /** @@ -918,6 +918,6 @@ interface SubscriptionService { @JvmOverloads fun updateTrial( params: SubscriptionUpdateTrialParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SubscriptionUpdateTrialResponse } 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 292db5b1..bc156366 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 @@ -45,10 +45,8 @@ import com.withorb.api.models.SubscriptionUpdateTrialParams import com.withorb.api.models.SubscriptionUpdateTrialResponse import com.withorb.api.models.SubscriptionUsage -class SubscriptionServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : SubscriptionService { +class SubscriptionServiceImpl internal constructor(private val clientOptions: ClientOptions) : + SubscriptionService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -296,7 +294,7 @@ internal constructor( */ override fun create( params: SubscriptionCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionCreateResponse { val request = HttpRequest.builder() @@ -324,7 +322,7 @@ internal constructor( */ override fun update( params: SubscriptionUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Subscription { val request = HttpRequest.builder() @@ -359,7 +357,7 @@ internal constructor( */ override fun list( params: SubscriptionListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionListPage { val request = HttpRequest.builder() @@ -437,7 +435,7 @@ internal constructor( */ override fun cancel( params: SubscriptionCancelParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionCancelResponse { val request = HttpRequest.builder() @@ -465,7 +463,7 @@ internal constructor( */ override fun fetch( params: SubscriptionFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Subscription { val request = HttpRequest.builder() @@ -500,7 +498,7 @@ internal constructor( */ override fun fetchCosts( params: SubscriptionFetchCostsParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionFetchCostsResponse { val request = HttpRequest.builder() @@ -529,7 +527,7 @@ internal constructor( */ override fun fetchSchedule( params: SubscriptionFetchScheduleParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionFetchSchedulePage { val request = HttpRequest.builder() @@ -730,7 +728,7 @@ internal constructor( */ override fun fetchUsage( params: SubscriptionFetchUsageParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionUsage { val request = HttpRequest.builder() @@ -821,7 +819,7 @@ internal constructor( */ override fun priceIntervals( params: SubscriptionPriceIntervalsParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionPriceIntervalsResponse { val request = HttpRequest.builder() @@ -1012,7 +1010,7 @@ internal constructor( */ override fun schedulePlanChange( params: SubscriptionSchedulePlanChangeParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionSchedulePlanChangeResponse { val request = HttpRequest.builder() @@ -1040,7 +1038,7 @@ internal constructor( */ override fun triggerPhase( params: SubscriptionTriggerPhaseParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionTriggerPhaseResponse { val request = HttpRequest.builder() @@ -1072,7 +1070,7 @@ internal constructor( */ override fun unscheduleCancellation( params: SubscriptionUnscheduleCancellationParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionUnscheduleCancellationResponse { val request = HttpRequest.builder() @@ -1104,7 +1102,7 @@ internal constructor( */ override fun unscheduleFixedFeeQuantityUpdates( params: SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse { val request = HttpRequest.builder() @@ -1112,7 +1110,7 @@ internal constructor( .addPathSegments( "subscriptions", params.getPathParam(0), - "unschedule_fixed_fee_quantity_updates" + "unschedule_fixed_fee_quantity_updates", ) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -1137,7 +1135,7 @@ internal constructor( */ override fun unschedulePendingPlanChanges( params: SubscriptionUnschedulePendingPlanChangesParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionUnschedulePendingPlanChangesResponse { val request = HttpRequest.builder() @@ -1145,7 +1143,7 @@ internal constructor( .addPathSegments( "subscriptions", params.getPathParam(0), - "unschedule_pending_plan_changes" + "unschedule_pending_plan_changes", ) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -1180,7 +1178,7 @@ internal constructor( */ override fun updateFixedFeeQuantity( params: SubscriptionUpdateFixedFeeQuantityParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionUpdateFixedFeeQuantityResponse { val request = HttpRequest.builder() @@ -1188,7 +1186,7 @@ internal constructor( .addPathSegments( "subscriptions", params.getPathParam(0), - "update_fixed_fee_quantity" + "update_fixed_fee_quantity", ) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -1227,7 +1225,7 @@ internal constructor( */ override fun updateTrial( params: SubscriptionUpdateTrialParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SubscriptionUpdateTrialResponse { val request = HttpRequest.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/TopLevelService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/TopLevelService.kt index b08476e3..54f3e497 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/TopLevelService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/TopLevelService.kt @@ -21,6 +21,6 @@ interface TopLevelService { @JvmOverloads fun ping( params: TopLevelPingParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): TopLevelPingResponse } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/TopLevelServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/TopLevelServiceImpl.kt index 0868239c..29ac973c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/TopLevelServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/TopLevelServiceImpl.kt @@ -15,10 +15,8 @@ import com.withorb.api.errors.OrbError import com.withorb.api.models.TopLevelPingParams import com.withorb.api.models.TopLevelPingResponse -class TopLevelServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : TopLevelService { +class TopLevelServiceImpl internal constructor(private val clientOptions: ClientOptions) : + TopLevelService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -35,7 +33,7 @@ internal constructor( */ override fun ping( params: TopLevelPingParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): TopLevelPingResponse { val request = HttpRequest.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/WebhookServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/WebhookServiceImpl.kt index 89f20728..8693aa72 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/WebhookServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/WebhookServiceImpl.kt @@ -25,10 +25,7 @@ private const val SIGNATURE_VERSION = "v1" private const val SIGNATURE_DELIMITER = " " private const val SIGNATURE_KEY_VALUE_DELIMITER = "=" -class WebhookServiceImpl -constructor( - private val clientOptions: ClientOptions, -) : WebhookService { +class WebhookServiceImpl constructor(private val clientOptions: ClientOptions) : WebhookService { @kotlin.ExperimentalStdlibApi override fun unwrap(payload: String, headers: Headers, secret: String?): JsonValue { verifySignature(payload, headers, secret) @@ -86,7 +83,7 @@ constructor( if ( MessageDigest.isEqual( actualSignature, - expectedSignature.toByteArray(Charsets.UTF_8) + expectedSignature.toByteArray(Charsets.UTF_8), ) ) { return 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 fea9ef1b..ec4d80a7 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 @@ -19,6 +19,6 @@ interface SubscriptionService { @JvmOverloads fun list( params: CouponSubscriptionListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CouponSubscriptionListPage } 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 b4997b99..64b3f593 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 @@ -15,10 +15,8 @@ import com.withorb.api.errors.OrbError import com.withorb.api.models.CouponSubscriptionListPage import com.withorb.api.models.CouponSubscriptionListParams -class SubscriptionServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : SubscriptionService { +class SubscriptionServiceImpl internal constructor(private val clientOptions: ClientOptions) : + SubscriptionService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -34,7 +32,7 @@ internal constructor( */ override fun list( params: CouponSubscriptionListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CouponSubscriptionListPage { val request = HttpRequest.builder() 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 05912b27..8995b8be 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 @@ -19,7 +19,7 @@ interface BalanceTransactionService { @JvmOverloads fun create( params: CustomerBalanceTransactionCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerBalanceTransactionCreateResponse /** @@ -52,6 +52,6 @@ interface BalanceTransactionService { @JvmOverloads fun list( params: CustomerBalanceTransactionListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerBalanceTransactionListPage } 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 5376d34f..a45f2c19 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 @@ -18,10 +18,8 @@ import com.withorb.api.models.CustomerBalanceTransactionCreateResponse import com.withorb.api.models.CustomerBalanceTransactionListPage import com.withorb.api.models.CustomerBalanceTransactionListParams -class BalanceTransactionServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : BalanceTransactionService { +class BalanceTransactionServiceImpl internal constructor(private val clientOptions: ClientOptions) : + BalanceTransactionService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -35,7 +33,7 @@ internal constructor( */ override fun create( params: CustomerBalanceTransactionCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerBalanceTransactionCreateResponse { val request = HttpRequest.builder() @@ -87,7 +85,7 @@ internal constructor( */ override fun list( params: CustomerBalanceTransactionListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerBalanceTransactionListPage { val request = HttpRequest.builder() 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 3825eafb..4485b622 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 @@ -125,7 +125,7 @@ interface CostService { @JvmOverloads fun list( params: CustomerCostListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCostListResponse /** @@ -241,6 +241,6 @@ interface CostService { @JvmOverloads fun listByExternalId( params: CustomerCostListByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCostListByExternalIdResponse } 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 f8f8a2d1..13c858b5 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 @@ -17,10 +17,7 @@ import com.withorb.api.models.CustomerCostListByExternalIdResponse import com.withorb.api.models.CustomerCostListParams import com.withorb.api.models.CustomerCostListResponse -class CostServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CostService { +class CostServiceImpl internal constructor(private val clientOptions: ClientOptions) : CostService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -140,7 +137,7 @@ internal constructor( */ override fun list( params: CustomerCostListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerCostListResponse { val request = HttpRequest.builder() @@ -274,7 +271,7 @@ internal constructor( */ override fun listByExternalId( params: CustomerCostListByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerCostListByExternalIdResponse { val request = HttpRequest.builder() @@ -283,7 +280,7 @@ internal constructor( "customers", "external_customer_id", params.getPathParam(0), - "costs" + "costs", ) .build() .prepare(clientOptions, params) 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 1403480d..cee46dcd 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 @@ -30,7 +30,7 @@ interface CreditService { @JvmOverloads fun list( params: CustomerCreditListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditListPage /** @@ -45,6 +45,6 @@ interface CreditService { @JvmOverloads fun listByExternalId( params: CustomerCreditListByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditListByExternalIdPage } 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 69e19d3d..86b5c91b 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 @@ -21,10 +21,8 @@ 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 -class CreditServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CreditService { +class CreditServiceImpl internal constructor(private val clientOptions: ClientOptions) : + CreditService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -51,7 +49,7 @@ internal constructor( */ override fun list( params: CustomerCreditListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerCreditListPage { val request = HttpRequest.builder() @@ -85,7 +83,7 @@ internal constructor( */ override fun listByExternalId( params: CustomerCreditListByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerCreditListByExternalIdPage { val request = HttpRequest.builder() @@ -94,7 +92,7 @@ internal constructor( "customers", "external_customer_id", params.getPathParam(0), - "credits" + "credits", ) .build() .prepare(clientOptions, params) 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 2b43dc64..ca718a60 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 @@ -98,7 +98,7 @@ interface LedgerService { @JvmOverloads fun list( params: CustomerCreditLedgerListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditLedgerListPage /** @@ -207,7 +207,7 @@ interface LedgerService { @JvmOverloads fun createEntry( params: CustomerCreditLedgerCreateEntryParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditLedgerCreateEntryResponse /** @@ -316,7 +316,7 @@ interface LedgerService { @JvmOverloads fun createEntryByExternalId( params: CustomerCreditLedgerCreateEntryByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditLedgerCreateEntryByExternalIdResponse /** @@ -401,6 +401,6 @@ interface LedgerService { @JvmOverloads fun listByExternalId( params: CustomerCreditLedgerListByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditLedgerListByExternalIdPage } 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 ddd25729..909995a8 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 @@ -22,10 +22,8 @@ import com.withorb.api.models.CustomerCreditLedgerListByExternalIdParams import com.withorb.api.models.CustomerCreditLedgerListPage import com.withorb.api.models.CustomerCreditLedgerListParams -class LedgerServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : LedgerService { +class LedgerServiceImpl internal constructor(private val clientOptions: ClientOptions) : + LedgerService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -114,7 +112,7 @@ internal constructor( */ override fun list( params: CustomerCreditLedgerListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerCreditLedgerListPage { val request = HttpRequest.builder() @@ -242,7 +240,7 @@ internal constructor( */ override fun createEntry( params: CustomerCreditLedgerCreateEntryParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerCreditLedgerCreateEntryResponse { val request = HttpRequest.builder() @@ -371,7 +369,7 @@ internal constructor( */ override fun createEntryByExternalId( params: CustomerCreditLedgerCreateEntryByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerCreditLedgerCreateEntryByExternalIdResponse { val request = HttpRequest.builder() @@ -381,7 +379,7 @@ internal constructor( "external_customer_id", params.getPathParam(0), "credits", - "ledger_entry" + "ledger_entry", ) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -482,7 +480,7 @@ internal constructor( */ override fun listByExternalId( params: CustomerCreditLedgerListByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerCreditLedgerListByExternalIdPage { val request = HttpRequest.builder() @@ -492,7 +490,7 @@ internal constructor( "external_customer_id", params.getPathParam(0), "credits", - "ledger" + "ledger", ) .build() .prepare(clientOptions, params) 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 f532a843..2ad8dc55 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 @@ -29,21 +29,21 @@ interface TopUpService { @JvmOverloads fun create( params: CustomerCreditTopUpCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditTopUpCreateResponse /** List top-ups */ @JvmOverloads fun list( params: CustomerCreditTopUpListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditTopUpListPage /** Delete top-up */ @JvmOverloads fun delete( params: CustomerCreditTopUpDeleteParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ) /** @@ -57,20 +57,20 @@ interface TopUpService { @JvmOverloads fun createByExternalId( params: CustomerCreditTopUpCreateByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditTopUpCreateByExternalIdResponse /** Delete top-up by external ID */ @JvmOverloads fun deleteByExternalId( params: CustomerCreditTopUpDeleteByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ) /** List top-ups by external ID */ @JvmOverloads fun listByExternalId( params: CustomerCreditTopUpListByExternalIdParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CustomerCreditTopUpListByExternalIdPage } 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 ef5c5ca8..0ca6a7bd 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 @@ -25,10 +25,8 @@ import com.withorb.api.models.CustomerCreditTopUpListByExternalIdParams import com.withorb.api.models.CustomerCreditTopUpListPage import com.withorb.api.models.CustomerCreditTopUpListParams -class TopUpServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : TopUpService { +class TopUpServiceImpl internal constructor(private val clientOptions: ClientOptions) : + TopUpService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -46,7 +44,7 @@ internal constructor( */ override fun create( params: CustomerCreditTopUpCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerCreditTopUpCreateResponse { val request = HttpRequest.builder() @@ -72,7 +70,7 @@ internal constructor( /** List top-ups */ override fun list( params: CustomerCreditTopUpListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerCreditTopUpListPage { val request = HttpRequest.builder() @@ -103,7 +101,7 @@ internal constructor( params.getPathParam(0), "credits", "top_ups", - params.getPathParam(1) + params.getPathParam(1), ) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -126,7 +124,7 @@ internal constructor( */ override fun createByExternalId( params: CustomerCreditTopUpCreateByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerCreditTopUpCreateByExternalIdResponse { val request = HttpRequest.builder() @@ -136,7 +134,7 @@ internal constructor( "external_customer_id", params.getPathParam(0), "credits", - "top_ups" + "top_ups", ) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -157,7 +155,7 @@ internal constructor( /** Delete top-up by external ID */ override fun deleteByExternalId( params: CustomerCreditTopUpDeleteByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ) { val request = HttpRequest.builder() @@ -168,7 +166,7 @@ internal constructor( params.getPathParam(0), "credits", "top_ups", - params.getPathParam(1) + params.getPathParam(1), ) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -184,7 +182,7 @@ internal constructor( /** List top-ups by external ID */ override fun listByExternalId( params: CustomerCreditTopUpListByExternalIdParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CustomerCreditTopUpListByExternalIdPage { val request = HttpRequest.builder() @@ -194,7 +192,7 @@ internal constructor( "external_customer_id", params.getPathParam(0), "credits", - "top_ups" + "top_ups", ) .build() .prepare(clientOptions, params) 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 aeec7ee3..ebb4175e 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 @@ -14,6 +14,6 @@ interface ExternalDimensionalPriceGroupIdService { @JvmOverloads fun retrieve( params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): DimensionalPriceGroup } 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 4bc9de52..a0c1a0cc 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 @@ -16,9 +16,8 @@ import com.withorb.api.models.DimensionalPriceGroup import com.withorb.api.models.DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams class ExternalDimensionalPriceGroupIdServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ExternalDimensionalPriceGroupIdService { +internal constructor(private val clientOptions: ClientOptions) : + ExternalDimensionalPriceGroupIdService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -28,7 +27,7 @@ internal constructor( /** Fetch dimensional price group by external ID */ override fun retrieve( params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): DimensionalPriceGroup { val request = HttpRequest.builder() @@ -36,7 +35,7 @@ internal constructor( .addPathSegments( "dimensional_price_groups", "external_dimensional_price_group_id", - params.getPathParam(0) + params.getPathParam(0), ) .build() .prepare(clientOptions, params) 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 38cdf95d..e6f3a932 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 @@ -51,7 +51,7 @@ interface BackfillService { @JvmOverloads fun create( params: EventBackfillCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): EventBackfillCreateResponse /** @@ -65,7 +65,7 @@ interface BackfillService { @JvmOverloads fun list( params: EventBackfillListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): EventBackfillListPage /** @@ -76,14 +76,14 @@ interface BackfillService { @JvmOverloads fun close( params: EventBackfillCloseParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): EventBackfillCloseResponse /** This endpoint is used to fetch a backfill given an identifier. */ @JvmOverloads fun fetch( params: EventBackfillFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): EventBackfillFetchResponse /** @@ -97,6 +97,6 @@ interface BackfillService { @JvmOverloads fun revert( params: EventBackfillRevertParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): EventBackfillRevertResponse } 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 047d7623..18286734 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 @@ -24,10 +24,8 @@ import com.withorb.api.models.EventBackfillListParams import com.withorb.api.models.EventBackfillRevertParams import com.withorb.api.models.EventBackfillRevertResponse -class BackfillServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : BackfillService { +class BackfillServiceImpl internal constructor(private val clientOptions: ClientOptions) : + BackfillService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -67,7 +65,7 @@ internal constructor( */ override fun create( params: EventBackfillCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): EventBackfillCreateResponse { val request = HttpRequest.builder() @@ -100,7 +98,7 @@ internal constructor( */ override fun list( params: EventBackfillListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): EventBackfillListPage { val request = HttpRequest.builder() @@ -130,7 +128,7 @@ internal constructor( */ override fun close( params: EventBackfillCloseParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): EventBackfillCloseResponse { val request = HttpRequest.builder() @@ -156,7 +154,7 @@ internal constructor( /** This endpoint is used to fetch a backfill given an identifier. */ override fun fetch( params: EventBackfillFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): EventBackfillFetchResponse { val request = HttpRequest.builder() @@ -188,7 +186,7 @@ internal constructor( */ override fun revert( params: EventBackfillRevertParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): EventBackfillRevertResponse { val request = HttpRequest.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/VolumeService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/VolumeService.kt index e28d16d6..ba6f1303 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/VolumeService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/VolumeService.kt @@ -26,6 +26,6 @@ interface VolumeService { @JvmOverloads fun list( params: EventVolumeListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): EventVolumes } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/VolumeServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/VolumeServiceImpl.kt index eaaaa459..2bec8c2f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/VolumeServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/events/VolumeServiceImpl.kt @@ -15,10 +15,8 @@ import com.withorb.api.errors.OrbError import com.withorb.api.models.EventVolumeListParams import com.withorb.api.models.EventVolumes -class VolumeServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : VolumeService { +class VolumeServiceImpl internal constructor(private val clientOptions: ClientOptions) : + VolumeService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) 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 e08eac13..a21cf3d2 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 @@ -20,7 +20,7 @@ interface ExternalPlanIdService { @JvmOverloads fun update( params: PlanExternalPlanIdUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Plan /** @@ -43,6 +43,6 @@ interface ExternalPlanIdService { @JvmOverloads fun fetch( params: PlanExternalPlanIdFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Plan } 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 c83b5076..d4248362 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 @@ -17,10 +17,8 @@ import com.withorb.api.models.Plan import com.withorb.api.models.PlanExternalPlanIdFetchParams import com.withorb.api.models.PlanExternalPlanIdUpdateParams -class ExternalPlanIdServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ExternalPlanIdService { +class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: ClientOptions) : + ExternalPlanIdService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -35,7 +33,7 @@ internal constructor( */ override fun update( params: PlanExternalPlanIdUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Plan { val request = HttpRequest.builder() @@ -76,7 +74,7 @@ internal constructor( */ override fun fetch( params: PlanExternalPlanIdFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Plan { val request = HttpRequest.builder() 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 b656beb8..23878048 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 @@ -18,7 +18,7 @@ interface ExternalPriceIdService { @JvmOverloads fun update( params: PriceExternalPriceIdUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Price /** @@ -29,6 +29,6 @@ interface ExternalPriceIdService { @JvmOverloads fun fetch( params: PriceExternalPriceIdFetchParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Price } 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 c199e14d..1e2a6c9e 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 @@ -17,10 +17,8 @@ import com.withorb.api.models.Price import com.withorb.api.models.PriceExternalPriceIdFetchParams import com.withorb.api.models.PriceExternalPriceIdUpdateParams -class ExternalPriceIdServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ExternalPriceIdService { +class ExternalPriceIdServiceImpl internal constructor(private val clientOptions: ClientOptions) : + ExternalPriceIdService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -33,7 +31,7 @@ internal constructor( */ override fun update( params: PriceExternalPriceIdUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Price { val request = HttpRequest.builder() @@ -62,7 +60,7 @@ internal constructor( */ override fun fetch( params: PriceExternalPriceIdFetchParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Price { val request = HttpRequest.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/TestServerExtension.kt b/orb-java-core/src/test/kotlin/com/withorb/api/TestServerExtension.kt index e9caa18d..4dd94b26 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/TestServerExtension.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/TestServerExtension.kt @@ -36,7 +36,7 @@ class TestServerExtension : BeforeAllCallback, ExecutionCondition { $ prism mock path/to/your.openapi.yml """ .trimIndent(), - e + e, ) } } 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 7dec06e5..0398347e 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 @@ -14,7 +14,7 @@ internal class PhantomReachableTest { // Pass an inline object for the object to observe so that it becomes immediately // unreachable. Any(), - closeable + closeable, ) assertThat(closed).isFalse() 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 18cf714e..ef06e6ce 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 @@ -11,28 +11,28 @@ internal class HeadersTest { enum class TestCase( val headers: Headers, val expectedMap: Map>, - val expectedSize: Int + val expectedSize: Int, ) { EMPTY(Headers.builder().build(), expectedMap = mapOf(), expectedSize = 0), PUT_ONE( Headers.builder().put("name", "value").build(), expectedMap = mapOf("name" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), PUT_MULTIPLE( Headers.builder().put("name", listOf("value1", "value2")).build(), expectedMap = mapOf("name" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT( Headers.builder().put("name1", "value").put("name2", "value").build(), expectedMap = mapOf("name1" to listOf("value"), "name2" to listOf("value")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT_SAME_NAME( Headers.builder().put("name", "value1").put("name", "value2").build(), expectedMap = mapOf("name" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT_MULTIPLE( Headers.builder() @@ -40,7 +40,7 @@ internal class HeadersTest { .put("name", listOf("value1", "value2")) .build(), expectedMap = mapOf("name" to listOf("value1", "value2", "value1", "value2")), - expectedSize = 4 + expectedSize = 4, ), PUT_CASE_INSENSITIVE( Headers.builder() @@ -49,25 +49,25 @@ internal class HeadersTest { .put("nAmE", "value3") .build(), expectedMap = mapOf("name" to listOf("value1", "value2", "value3")), - expectedSize = 3 + expectedSize = 3, ), PUT_ALL_MAP( Headers.builder() .putAll( mapOf( "name1" to listOf("value1", "value2"), - "name2" to listOf("value1", "value2") + "name2" to listOf("value1", "value2"), ) ) .build(), expectedMap = mapOf("name1" to listOf("value1", "value2"), "name2" to listOf("value1", "value2")), - expectedSize = 4 + expectedSize = 4, ), PUT_ALL_HEADERS( Headers.builder().putAll(Headers.builder().put("name", "value").build()).build(), expectedMap = mapOf("name" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), PUT_ALL_CASE_INSENSITIVE( Headers.builder() @@ -75,32 +75,32 @@ internal class HeadersTest { mapOf( "name" to listOf("value1"), "NAME" to listOf("value2"), - "nAmE" to listOf("value3") + "nAmE" to listOf("value3"), ) ) .build(), expectedMap = mapOf("name" to listOf("value1", "value2", "value3")), - expectedSize = 3 + expectedSize = 3, ), REMOVE_ABSENT( Headers.builder().remove("name").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_PRESENT_ONE( Headers.builder().put("name", "value").remove("name").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_PRESENT_MULTIPLE( Headers.builder().put("name", listOf("value1", "value2")).remove("name").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_CASE_INSENSITIVE( Headers.builder().put("name", listOf("value1", "value2")).remove("NAME").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_ALL( Headers.builder() @@ -109,7 +109,7 @@ internal class HeadersTest { .removeAll(setOf("name1", "name2", "name3")) .build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_ALL_CASE_INSENSITIVE( Headers.builder() @@ -118,22 +118,22 @@ internal class HeadersTest { .removeAll(setOf("NAME1", "nAmE3")) .build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), CLEAR( Headers.builder().put("name1", "value").put("name2", "value").clear().build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REPLACE_ONE_ABSENT( Headers.builder().replace("name", "value").build(), expectedMap = mapOf("name" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_ONE_PRESENT_ONE( Headers.builder().put("name", "value1").replace("name", "value2").build(), expectedMap = mapOf("name" to listOf("value2")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_ONE_PRESENT_MULTIPLE( Headers.builder() @@ -141,12 +141,12 @@ internal class HeadersTest { .replace("name", "value3") .build(), expectedMap = mapOf("name" to listOf("value3")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_MULTIPLE_ABSENT( Headers.builder().replace("name", listOf("value1", "value2")).build(), expectedMap = mapOf("name" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_MULTIPLE_PRESENT_ONE( Headers.builder() @@ -154,7 +154,7 @@ internal class HeadersTest { .replace("name", listOf("value2", "value3")) .build(), expectedMap = mapOf("name" to listOf("value2", "value3")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_MULTIPLE_PRESENT_MULTIPLE( Headers.builder() @@ -162,7 +162,7 @@ internal class HeadersTest { .replace("name", listOf("value3", "value4")) .build(), expectedMap = mapOf("name" to listOf("value3", "value4")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_CASE_INSENSITIVE( Headers.builder() @@ -170,7 +170,7 @@ internal class HeadersTest { .replace("NAME", listOf("value2", "value3")) .build(), expectedMap = mapOf("NAME" to listOf("value2", "value3")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_ALL_MAP( Headers.builder() @@ -183,9 +183,9 @@ internal class HeadersTest { mapOf( "name1" to listOf("value2"), "name2" to listOf("value1"), - "name3" to listOf("value2") + "name3" to listOf("value2"), ), - expectedSize = 3 + expectedSize = 3, ), REPLACE_ALL_HEADERS( Headers.builder() @@ -198,9 +198,9 @@ internal class HeadersTest { mapOf( "name1" to listOf("value2"), "name2" to listOf("value1"), - "name3" to listOf("value2") + "name3" to listOf("value2"), ), - expectedSize = 3 + expectedSize = 3, ), REPLACE_ALL_CASE_INSENSITIVE( Headers.builder() @@ -209,8 +209,8 @@ internal class HeadersTest { .replaceAll(mapOf("NAME1" to listOf("value2"), "nAmE2" to listOf("value2"))) .build(), expectedMap = mapOf("NAME1" to listOf("value2"), "nAmE2" to listOf("value2")), - expectedSize = 2 - ) + expectedSize = 2, + ), } @ParameterizedTest 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 8761a111..11c28d37 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 @@ -11,28 +11,28 @@ internal class QueryParamsTest { enum class TestCase( val queryParams: QueryParams, val expectedMap: Map>, - val expectedSize: Int + val expectedSize: Int, ) { EMPTY(QueryParams.builder().build(), expectedMap = mapOf(), expectedSize = 0), PUT_ONE( QueryParams.builder().put("key", "value").build(), expectedMap = mapOf("key" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), PUT_MULTIPLE( QueryParams.builder().put("key", listOf("value1", "value2")).build(), expectedMap = mapOf("key" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT( QueryParams.builder().put("key1", "value").put("key2", "value").build(), expectedMap = mapOf("key1" to listOf("value"), "key2" to listOf("value")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT_SAME_NAME( QueryParams.builder().put("key", "value1").put("key", "value2").build(), expectedMap = mapOf("key" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT_MULTIPLE( QueryParams.builder() @@ -40,40 +40,40 @@ internal class QueryParamsTest { .put("key", listOf("value1", "value2")) .build(), expectedMap = mapOf("key" to listOf("value1", "value2", "value1", "value2")), - expectedSize = 4 + expectedSize = 4, ), PUT_ALL_MAP( QueryParams.builder() .putAll( mapOf( "key1" to listOf("value1", "value2"), - "key2" to listOf("value1", "value2") + "key2" to listOf("value1", "value2"), ) ) .build(), expectedMap = mapOf("key1" to listOf("value1", "value2"), "key2" to listOf("value1", "value2")), - expectedSize = 4 + expectedSize = 4, ), PUT_ALL_HEADERS( QueryParams.builder().putAll(QueryParams.builder().put("key", "value").build()).build(), expectedMap = mapOf("key" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), REMOVE_ABSENT( QueryParams.builder().remove("key").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_PRESENT_ONE( QueryParams.builder().put("key", "value").remove("key").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_PRESENT_MULTIPLE( QueryParams.builder().put("key", listOf("value1", "value2")).remove("key").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_ALL( QueryParams.builder() @@ -82,22 +82,22 @@ internal class QueryParamsTest { .removeAll(setOf("key1", "key2", "key3")) .build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), CLEAR( QueryParams.builder().put("key1", "value").put("key2", "value").clear().build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REPLACE_ONE_ABSENT( QueryParams.builder().replace("key", "value").build(), expectedMap = mapOf("key" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_ONE_PRESENT_ONE( QueryParams.builder().put("key", "value1").replace("key", "value2").build(), expectedMap = mapOf("key" to listOf("value2")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_ONE_PRESENT_MULTIPLE( QueryParams.builder() @@ -105,12 +105,12 @@ internal class QueryParamsTest { .replace("key", "value3") .build(), expectedMap = mapOf("key" to listOf("value3")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_MULTIPLE_ABSENT( QueryParams.builder().replace("key", listOf("value1", "value2")).build(), expectedMap = mapOf("key" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_MULTIPLE_PRESENT_ONE( QueryParams.builder() @@ -118,7 +118,7 @@ internal class QueryParamsTest { .replace("key", listOf("value2", "value3")) .build(), expectedMap = mapOf("key" to listOf("value2", "value3")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_MULTIPLE_PRESENT_MULTIPLE( QueryParams.builder() @@ -126,7 +126,7 @@ internal class QueryParamsTest { .replace("key", listOf("value3", "value4")) .build(), expectedMap = mapOf("key" to listOf("value3", "value4")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_ALL_MAP( QueryParams.builder() @@ -139,9 +139,9 @@ internal class QueryParamsTest { mapOf( "key1" to listOf("value2"), "key2" to listOf("value1"), - "key3" to listOf("value2") + "key3" to listOf("value2"), ), - expectedSize = 3 + expectedSize = 3, ), REPLACE_ALL_HEADERS( QueryParams.builder() @@ -156,10 +156,10 @@ internal class QueryParamsTest { mapOf( "key1" to listOf("value2"), "key2" to listOf("value1"), - "key3" to listOf("value2") + "key3" to listOf("value2"), ), - expectedSize = 3 - ) + expectedSize = 3, + ), } @ParameterizedTest 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 917372c0..2311043c 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 @@ -26,12 +26,12 @@ internal class RetryingHttpClientTest { object : HttpClient { override fun execute( request: HttpRequest, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): HttpResponse = trackClose(okHttpClient.execute(request, requestOptions)) override fun executeAsync( request: HttpRequest, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture = okHttpClient.executeAsync(request, requestOptions).thenApply { trackClose(it) } @@ -71,7 +71,7 @@ internal class RetryingHttpClientTest { val response = retryingClient.execute( HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), - async + async, ) assertThat(response.statusCode()).isEqualTo(200) @@ -97,7 +97,7 @@ internal class RetryingHttpClientTest { val response = retryingClient.execute( HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), - async + async, ) assertThat(response.statusCode()).isEqualTo(200) @@ -140,24 +140,24 @@ internal class RetryingHttpClientTest { val response = retryingClient.execute( HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), - async + async, ) assertThat(response.statusCode()).isEqualTo(200) verify( 1, postRequestedFor(urlPathEqualTo("/something")) - .withHeader("x-stainless-retry-count", equalTo("0")) + .withHeader("x-stainless-retry-count", equalTo("0")), ) verify( 1, postRequestedFor(urlPathEqualTo("/something")) - .withHeader("x-stainless-retry-count", equalTo("1")) + .withHeader("x-stainless-retry-count", equalTo("1")), ) verify( 1, postRequestedFor(urlPathEqualTo("/something")) - .withHeader("x-stainless-retry-count", equalTo("2")) + .withHeader("x-stainless-retry-count", equalTo("2")), ) assertNoResponseLeaks() } @@ -191,14 +191,14 @@ internal class RetryingHttpClientTest { .addPathSegment("something") .putHeader("x-stainless-retry-count", "42") .build(), - async + async, ) assertThat(response.statusCode()).isEqualTo(200) verify( 2, postRequestedFor(urlPathEqualTo("/something")) - .withHeader("x-stainless-retry-count", equalTo("42")) + .withHeader("x-stainless-retry-count", equalTo("42")), ) assertNoResponseLeaks() } @@ -226,7 +226,7 @@ internal class RetryingHttpClientTest { val response = retryingClient.execute( HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), - async + async, ) assertThat(response.statusCode()).isEqualTo(200) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/http/SerializerTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/SerializerTest.kt index 234ff9bf..b61203bc 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/core/http/SerializerTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/http/SerializerTest.kt @@ -48,11 +48,7 @@ internal class SerializerTest { override fun hashCode(): Int { if (hashCode == 0) { - hashCode = - Objects.hash( - isActive, - additionalProperties, - ) + hashCode = Objects.hash(isActive, additionalProperties) } return hashCode } @@ -91,10 +87,7 @@ internal class SerializerTest { } fun build(): ClassWithBooleanFieldPrefixedWithIs = - ClassWithBooleanFieldPrefixedWithIs( - isActive, - additionalProperties.toImmutable(), - ) + ClassWithBooleanFieldPrefixedWithIs(isActive, additionalProperties.toImmutable()) } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForCustomerParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForCustomerParamsTest.kt index c6937b5d..9c0e8517 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForCustomerParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForCustomerParamsTest.kt @@ -26,7 +26,9 @@ class AlertCreateForCustomerParamsTest { .type(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) .addThreshold(AlertCreateForCustomerParams.Threshold.builder().value(0.0).build()) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.currency()).isEqualTo("currency") assertThat(body.type()).isEqualTo(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) @@ -42,7 +44,9 @@ class AlertCreateForCustomerParamsTest { .currency("currency") .type(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.currency()).isEqualTo("currency") assertThat(body.type()).isEqualTo(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParamsTest.kt index 41bd6f48..eda3baa0 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParamsTest.kt @@ -30,7 +30,9 @@ class AlertCreateForExternalCustomerParamsTest { AlertCreateForExternalCustomerParams.Threshold.builder().value(0.0).build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.currency()).isEqualTo("currency") assertThat(body.type()).isEqualTo(AlertCreateForExternalCustomerParams.Type.USAGE_EXCEEDED) @@ -48,7 +50,9 @@ class AlertCreateForExternalCustomerParamsTest { .currency("currency") .type(AlertCreateForExternalCustomerParams.Type.USAGE_EXCEEDED) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.currency()).isEqualTo("currency") assertThat(body.type()).isEqualTo(AlertCreateForExternalCustomerParams.Type.USAGE_EXCEEDED) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParamsTest.kt index 1ab8b416..b7e271f8 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParamsTest.kt @@ -28,7 +28,9 @@ class AlertCreateForSubscriptionParamsTest { .type(AlertCreateForSubscriptionParams.Type.USAGE_EXCEEDED) .metricId("metric_id") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.thresholds()) .isEqualTo( @@ -48,7 +50,9 @@ class AlertCreateForSubscriptionParamsTest { ) .type(AlertCreateForSubscriptionParams.Type.USAGE_EXCEEDED) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.thresholds()) .isEqualTo( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertUpdateParamsTest.kt index 04a32c10..db679d67 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertUpdateParamsTest.kt @@ -22,7 +22,9 @@ class AlertUpdateParamsTest { .alertConfigurationId("alert_configuration_id") .addThreshold(AlertUpdateParams.Threshold.builder().value(0.0).build()) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.thresholds()) .isEqualTo(listOf(AlertUpdateParams.Threshold.builder().value(0.0).build())) @@ -35,7 +37,9 @@ class AlertUpdateParamsTest { .alertConfigurationId("alert_configuration_id") .addThreshold(AlertUpdateParams.Threshold.builder().value(0.0).build()) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.thresholds()) .isEqualTo(listOf(AlertUpdateParams.Threshold.builder().value(0.0).build())) 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 5db42633..50353981 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 @@ -26,7 +26,9 @@ class CouponCreateParamsTest { .durationInMonths(12L) .maxRedemptions(1L) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.discount()) .isEqualTo( @@ -52,7 +54,9 @@ class CouponCreateParamsTest { .newCouponPercentageDiscount(0.0) .redemptionCode("HALFOFF") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.discount()) .isEqualTo( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteCreateParamsTest.kt index 58bd4270..b477c198 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteCreateParamsTest.kt @@ -34,7 +34,9 @@ class CreditNoteCreateParamsTest { .memo("An optional memo for my credit note.") .reason(CreditNoteCreateParams.Reason.DUPLICATE) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.lineItems()) .isEqualTo( @@ -60,7 +62,9 @@ class CreditNoteCreateParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.lineItems()) .isEqualTo( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParamsTest.kt index 4caaee3c..8dbea9f5 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParamsTest.kt @@ -26,7 +26,9 @@ class CustomerBalanceTransactionCreateParamsTest { .type(CustomerBalanceTransactionCreateParams.Type.INCREMENT) .description("description") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.amount()).isEqualTo("amount") assertThat(body.type()).isEqualTo(CustomerBalanceTransactionCreateParams.Type.INCREMENT) @@ -41,7 +43,9 @@ class CustomerBalanceTransactionCreateParamsTest { .amount("amount") .type(CustomerBalanceTransactionCreateParams.Type.INCREMENT) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.amount()).isEqualTo("amount") assertThat(body.type()).isEqualTo(CustomerBalanceTransactionCreateParams.Type.INCREMENT) 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 638a96f7..1900e026 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 @@ -85,7 +85,7 @@ class CustomerCostListByExternalIdResponseTest { Price.UnitPrice.Metadata.builder() .putAdditionalProperty( "foo", - JsonValue.from("string") + JsonValue.from("string"), ) .build() ) 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 3286a009..6181b9b2 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 @@ -85,7 +85,7 @@ class CustomerCostListResponseTest { Price.UnitPrice.Metadata.builder() .putAdditionalProperty( "foo", - JsonValue.from("string") + JsonValue.from("string"), ) .build() ) 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 6c0ba976..a3f26e33 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 @@ -154,7 +154,9 @@ class CustomerCreateParamsTest { ) .timezone("timezone") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.email()).isEqualTo("dev@stainlessapi.com") assertThat(body.name()).isEqualTo("x") @@ -236,7 +238,9 @@ class CustomerCreateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = CustomerCreateParams.builder().email("dev@stainlessapi.com").name("x").build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.email()).isEqualTo("dev@stainlessapi.com") assertThat(body.name()).isEqualTo("x") 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 46544ad5..12f39125 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 @@ -12,13 +12,14 @@ class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { @Test fun create() { CustomerCreditLedgerCreateEntryByExternalIdParams.builder() - .forAddIncrementCreditLedgerEntryRequestParams( - CustomerCreditLedgerCreateEntryByExternalIdParams + .externalCustomerId("external_customer_id") + .body( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) .entryType( - CustomerCreditLedgerCreateEntryByExternalIdParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body .AddIncrementCreditLedgerEntryRequestParams .EntryType .INCREMENT @@ -28,7 +29,7 @@ class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .invoiceSettings( - CustomerCreditLedgerCreateEntryByExternalIdParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body .AddIncrementCreditLedgerEntryRequestParams .InvoiceSettings .builder() @@ -39,7 +40,7 @@ class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { .build() ) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body .AddIncrementCreditLedgerEntryRequestParams .Metadata .builder() @@ -49,28 +50,135 @@ class CustomerCreditLedgerCreateEntryByExternalIdParamsTest { .perUnitCostBasis("per_unit_cost_basis") .build() ) - .externalCustomerId("external_customer_id") .build() } @Test - fun getPathParam() { + fun body() { val params = CustomerCreditLedgerCreateEntryByExternalIdParams.builder() - .forAddIncrementCreditLedgerEntryRequestParams( - CustomerCreditLedgerCreateEntryByExternalIdParams + .externalCustomerId("external_customer_id") + .body( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) .entryType( - CustomerCreditLedgerCreateEntryByExternalIdParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body .AddIncrementCreditLedgerEntryRequestParams .EntryType .INCREMENT ) + .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() ) + .build() + + val body = params._body() + + assertThat(body).isNotNull + assertThat(body) + .isEqualTo( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body + .ofAddIncrementCreditLedgerEntryRequestParams( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .builder() + .amount(0.0) + .entryType( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .EntryType + .INCREMENT + ) + .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() + ) + ) + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + CustomerCreditLedgerCreateEntryByExternalIdParams.builder() + .externalCustomerId("external_customer_id") + .addIncrementCreditLedgerEntryRequestParamsBody(0.0) + .build() + + val body = params._body() + + assertThat(body).isNotNull + assertThat(body) + .isEqualTo( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body + .ofAddIncrementCreditLedgerEntryRequestParams( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .builder() + .amount(0.0) + .entryType( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .EntryType + .INCREMENT + ) + .build() + ) + ) + } + + @Test + fun getPathParam() { + val params = + CustomerCreditLedgerCreateEntryByExternalIdParams.builder() .externalCustomerId("external_customer_id") + .addIncrementCreditLedgerEntryRequestParamsBody(0.0) .build() assertThat(params).isNotNull // path param "externalCustomerId" 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 d765fce5..e1f804ae 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 @@ -12,12 +12,14 @@ class CustomerCreditLedgerCreateEntryParamsTest { @Test fun create() { CustomerCreditLedgerCreateEntryParams.builder() - .forAddIncrementCreditLedgerEntryRequestParams( - CustomerCreditLedgerCreateEntryParams.AddIncrementCreditLedgerEntryRequestParams + .customerId("customer_id") + .body( + CustomerCreditLedgerCreateEntryParams.Body + .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) .entryType( - CustomerCreditLedgerCreateEntryParams + CustomerCreditLedgerCreateEntryParams.Body .AddIncrementCreditLedgerEntryRequestParams .EntryType .INCREMENT @@ -27,7 +29,7 @@ class CustomerCreditLedgerCreateEntryParamsTest { .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .invoiceSettings( - CustomerCreditLedgerCreateEntryParams + CustomerCreditLedgerCreateEntryParams.Body .AddIncrementCreditLedgerEntryRequestParams .InvoiceSettings .builder() @@ -38,7 +40,7 @@ class CustomerCreditLedgerCreateEntryParamsTest { .build() ) .metadata( - CustomerCreditLedgerCreateEntryParams + CustomerCreditLedgerCreateEntryParams.Body .AddIncrementCreditLedgerEntryRequestParams .Metadata .builder() @@ -48,27 +50,135 @@ class CustomerCreditLedgerCreateEntryParamsTest { .perUnitCostBasis("per_unit_cost_basis") .build() ) - .customerId("customer_id") .build() } @Test - fun getPathParam() { + fun body() { val params = CustomerCreditLedgerCreateEntryParams.builder() - .forAddIncrementCreditLedgerEntryRequestParams( - CustomerCreditLedgerCreateEntryParams.AddIncrementCreditLedgerEntryRequestParams + .customerId("customer_id") + .body( + CustomerCreditLedgerCreateEntryParams.Body + .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) .entryType( - CustomerCreditLedgerCreateEntryParams + CustomerCreditLedgerCreateEntryParams.Body .AddIncrementCreditLedgerEntryRequestParams .EntryType .INCREMENT ) + .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() ) + .build() + + val body = params._body() + + assertThat(body).isNotNull + assertThat(body) + .isEqualTo( + CustomerCreditLedgerCreateEntryParams.Body + .ofAddIncrementCreditLedgerEntryRequestParams( + CustomerCreditLedgerCreateEntryParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .builder() + .amount(0.0) + .entryType( + CustomerCreditLedgerCreateEntryParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .EntryType + .INCREMENT + ) + .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() + ) + ) + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + CustomerCreditLedgerCreateEntryParams.builder() + .customerId("customer_id") + .addIncrementCreditLedgerEntryRequestParamsBody(0.0) + .build() + + val body = params._body() + + assertThat(body).isNotNull + assertThat(body) + .isEqualTo( + CustomerCreditLedgerCreateEntryParams.Body + .ofAddIncrementCreditLedgerEntryRequestParams( + CustomerCreditLedgerCreateEntryParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .builder() + .amount(0.0) + .entryType( + CustomerCreditLedgerCreateEntryParams.Body + .AddIncrementCreditLedgerEntryRequestParams + .EntryType + .INCREMENT + ) + .build() + ) + ) + } + + @Test + fun getPathParam() { + val params = + CustomerCreditLedgerCreateEntryParams.builder() .customerId("customer_id") + .addIncrementCreditLedgerEntryRequestParamsBody(0.0) .build() assertThat(params).isNotNull // path param "customerId" diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParamsTest.kt index ee91b1e2..55dcc695 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParamsTest.kt @@ -51,11 +51,11 @@ class CustomerCreditLedgerListByExternalIdParamsTest { expected.put("cursor", "cursor") expected.put( "entry_status", - CustomerCreditLedgerListByExternalIdParams.EntryStatus.COMMITTED.toString() + CustomerCreditLedgerListByExternalIdParams.EntryStatus.COMMITTED.toString(), ) expected.put( "entry_type", - CustomerCreditLedgerListByExternalIdParams.EntryType.INCREMENT.toString() + CustomerCreditLedgerListByExternalIdParams.EntryType.INCREMENT.toString(), ) expected.put("limit", "1") expected.put("minimum_amount", "minimum_amount") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListParamsTest.kt index e9e33483..4e2ccb46 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListParamsTest.kt @@ -51,7 +51,7 @@ class CustomerCreditLedgerListParamsTest { expected.put("cursor", "cursor") expected.put( "entry_status", - CustomerCreditLedgerListParams.EntryStatus.COMMITTED.toString() + CustomerCreditLedgerListParams.EntryStatus.COMMITTED.toString(), ) expected.put("entry_type", CustomerCreditLedgerListParams.EntryType.INCREMENT.toString()) expected.put("limit", "1") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParamsTest.kt index 212fef57..24eee848 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParamsTest.kt @@ -48,7 +48,9 @@ class CustomerCreditTopUpCreateByExternalIdParamsTest { .expiresAfter(0L) .expiresAfterUnit(CustomerCreditTopUpCreateByExternalIdParams.ExpiresAfterUnit.DAY) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.amount()).isEqualTo("amount") assertThat(body.currency()).isEqualTo("currency") @@ -84,7 +86,9 @@ class CustomerCreditTopUpCreateByExternalIdParamsTest { .perUnitCostBasis("per_unit_cost_basis") .threshold("threshold") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.amount()).isEqualTo("amount") assertThat(body.currency()).isEqualTo("currency") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParamsTest.kt index eadfb5e5..f6ef345a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParamsTest.kt @@ -48,7 +48,9 @@ class CustomerCreditTopUpCreateParamsTest { .expiresAfter(0L) .expiresAfterUnit(CustomerCreditTopUpCreateParams.ExpiresAfterUnit.DAY) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.amount()).isEqualTo("amount") assertThat(body.currency()).isEqualTo("currency") @@ -84,7 +86,9 @@ class CustomerCreditTopUpCreateParamsTest { .perUnitCostBasis("per_unit_cost_basis") .threshold("threshold") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.amount()).isEqualTo("amount") assertThat(body.currency()).isEqualTo("currency") 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 8994933b..5228a65a 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 @@ -164,7 +164,9 @@ class CustomerUpdateByExternalIdParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.accountingSyncConfiguration()) .contains( @@ -253,7 +255,9 @@ class CustomerUpdateByExternalIdParamsTest { @Test fun bodyWithoutOptionalFields() { val params = CustomerUpdateByExternalIdParams.builder().id("external_customer_id").build() + val body = params._body() + assertThat(body).isNotNull } 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 17ea8661..f7c53757 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 @@ -154,7 +154,9 @@ class CustomerUpdateParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.accountingSyncConfiguration()) .contains( @@ -235,7 +237,9 @@ class CustomerUpdateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = CustomerUpdateParams.builder().customerId("customer_id").build() + val body = params._body() + assertThat(body).isNotNull } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParamsTest.kt index 56ff0efb..42b03c38 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParamsTest.kt @@ -39,7 +39,9 @@ class DimensionalPriceGroupCreateParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.billableMetricId()).isEqualTo("billable_metric_id") assertThat(body.dimensions()).isEqualTo(listOf("region", "instance_type")) @@ -63,7 +65,9 @@ class DimensionalPriceGroupCreateParamsTest { .addDimension("instance_type") .name("name") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.billableMetricId()).isEqualTo("billable_metric_id") assertThat(body.dimensions()).isEqualTo(listOf("region", "instance_type")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/EventBackfillCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/EventBackfillCreateParamsTest.kt index 63e53b41..71aa60f0 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/EventBackfillCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/EventBackfillCreateParamsTest.kt @@ -33,7 +33,9 @@ class EventBackfillCreateParamsTest { .externalCustomerId("external_customer_id") .replaceExistingEvents(true) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.timeframeEnd()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(body.timeframeStart()) @@ -53,7 +55,9 @@ class EventBackfillCreateParamsTest { .timeframeEnd(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .timeframeStart(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.timeframeEnd()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(body.timeframeStart()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/EventIngestParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/EventIngestParamsTest.kt index ed44547c..b338832a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/EventIngestParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/EventIngestParamsTest.kt @@ -13,6 +13,8 @@ class EventIngestParamsTest { @Test fun create() { EventIngestParams.builder() + .backfillId("backfill_id") + .debug(true) .addEvent( EventIngestParams.Event.builder() .eventName("event_name") @@ -23,8 +25,6 @@ class EventIngestParamsTest { .externalCustomerId("external_customer_id") .build() ) - .backfillId("backfill_id") - .debug(true) .build() } @@ -32,6 +32,8 @@ class EventIngestParamsTest { fun queryParams() { val params = EventIngestParams.builder() + .backfillId("backfill_id") + .debug(true) .addEvent( EventIngestParams.Event.builder() .eventName("event_name") @@ -42,8 +44,6 @@ class EventIngestParamsTest { .externalCustomerId("external_customer_id") .build() ) - .backfillId("backfill_id") - .debug(true) .build() val expected = QueryParams.builder() expected.put("backfill_id", "backfill_id") @@ -72,6 +72,8 @@ class EventIngestParamsTest { fun body() { val params = EventIngestParams.builder() + .backfillId("backfill_id") + .debug(true) .addEvent( EventIngestParams.Event.builder() .eventName("event_name") @@ -82,10 +84,10 @@ class EventIngestParamsTest { .externalCustomerId("external_customer_id") .build() ) - .backfillId("backfill_id") - .debug(true) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.events()) .isEqualTo( @@ -115,7 +117,9 @@ class EventIngestParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.events()) .isEqualTo( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/EventSearchParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/EventSearchParamsTest.kt index d3f2907f..b57eddac 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/EventSearchParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/EventSearchParamsTest.kt @@ -25,7 +25,9 @@ class EventSearchParamsTest { .timeframeEnd(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .timeframeStart(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.eventIds()).isEqualTo(listOf("string")) assertThat(body.timeframeEnd()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -35,7 +37,9 @@ class EventSearchParamsTest { @Test fun bodyWithoutOptionalFields() { val params = EventSearchParams.builder().addEventId("string").build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.eventIds()).isEqualTo(listOf("string")) } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/EventUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/EventUpdateParamsTest.kt index ed46deb6..1146aa2f 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/EventUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/EventUpdateParamsTest.kt @@ -32,7 +32,9 @@ class EventUpdateParamsTest { .customerId("customer_id") .externalCustomerId("external_customer_id") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.eventName()).isEqualTo("event_name") assertThat(body._properties()).isEqualTo(JsonValue.from(mapOf())) @@ -50,7 +52,9 @@ class EventUpdateParamsTest { .properties(JsonValue.from(mapOf())) .timestamp(OffsetDateTime.parse("2020-12-09T16:09:53Z")) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.eventName()).isEqualTo("event_name") assertThat(body._properties()).isEqualTo(JsonValue.from(mapOf())) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceCreateParamsTest.kt index 29b303a9..18b91273 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceCreateParamsTest.kt @@ -93,7 +93,9 @@ class InvoiceCreateParamsTest { ) .willAutoIssue(false) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.currency()).isEqualTo("USD") assertThat(body.invoiceDate()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -163,7 +165,9 @@ class InvoiceCreateParamsTest { ) .netTerms(0L) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.currency()).isEqualTo("USD") assertThat(body.invoiceDate()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceIssueParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceIssueParamsTest.kt index 2917fee2..c4224971 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceIssueParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceIssueParamsTest.kt @@ -15,7 +15,9 @@ class InvoiceIssueParamsTest { @Test fun body() { val params = InvoiceIssueParams.builder().invoiceId("invoice_id").synchronous(true).build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.synchronous()).contains(true) } @@ -23,7 +25,9 @@ class InvoiceIssueParamsTest { @Test fun bodyWithoutOptionalFields() { val params = InvoiceIssueParams.builder().invoiceId("invoice_id").build() + val body = params._body() + assertThat(body).isNotNull } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateParamsTest.kt index d4ae388b..148b76d0 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateParamsTest.kt @@ -31,7 +31,9 @@ class InvoiceLineItemCreateParamsTest { .quantity(1.0) .startDate(LocalDate.parse("2023-09-22")) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.amount()).isEqualTo("12.00") assertThat(body.endDate()).isEqualTo(LocalDate.parse("2023-09-22")) @@ -52,7 +54,9 @@ class InvoiceLineItemCreateParamsTest { .quantity(1.0) .startDate(LocalDate.parse("2023-09-22")) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.amount()).isEqualTo("12.00") assertThat(body.endDate()).isEqualTo(LocalDate.parse("2023-09-22")) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceMarkPaidParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceMarkPaidParamsTest.kt index 102d7daa..a4da0734 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceMarkPaidParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceMarkPaidParamsTest.kt @@ -27,7 +27,9 @@ class InvoiceMarkPaidParamsTest { .externalId("external_payment_id_123") .notes("notes") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.paymentReceivedDate()).isEqualTo(LocalDate.parse("2023-09-22")) assertThat(body.externalId()).contains("external_payment_id_123") @@ -41,7 +43,9 @@ class InvoiceMarkPaidParamsTest { .invoiceId("invoice_id") .paymentReceivedDate(LocalDate.parse("2023-09-22")) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.paymentReceivedDate()).isEqualTo(LocalDate.parse("2023-09-22")) } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceUpdateParamsTest.kt index a9f7eebc..5eb0153b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceUpdateParamsTest.kt @@ -31,7 +31,9 @@ class InvoiceUpdateParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.metadata()) .contains( @@ -44,7 +46,9 @@ class InvoiceUpdateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = InvoiceUpdateParams.builder().invoiceId("invoice_id").build() + val body = params._body() + assertThat(body).isNotNull } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/ItemCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/ItemCreateParamsTest.kt index 33e131fd..3f28fe97 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/ItemCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/ItemCreateParamsTest.kt @@ -15,7 +15,9 @@ class ItemCreateParamsTest { @Test fun body() { val params = ItemCreateParams.builder().name("API requests").build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.name()).isEqualTo("API requests") } @@ -23,7 +25,9 @@ class ItemCreateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = ItemCreateParams.builder().name("API requests").build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.name()).isEqualTo("API requests") } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/ItemUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/ItemUpdateParamsTest.kt index 1df6d5a4..2c3799a6 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/ItemUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/ItemUpdateParamsTest.kt @@ -38,7 +38,9 @@ class ItemUpdateParamsTest { ) .name("name") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.externalConnections()) .contains( @@ -57,7 +59,9 @@ class ItemUpdateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = ItemUpdateParams.builder().itemId("item_id").build() + val body = params._body() + assertThat(body).isNotNull } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricCreateParamsTest.kt index 5c332e14..26cea020 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricCreateParamsTest.kt @@ -37,7 +37,9 @@ class MetricCreateParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.description()).contains("Sum of bytes downloaded in fast mode") assertThat(body.itemId()).isEqualTo("item_id") @@ -61,7 +63,9 @@ class MetricCreateParamsTest { .name("Bytes downloaded") .sql("SELECT sum(bytes_downloaded) FROM events WHERE download_speed = 'fast'") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.description()).contains("Sum of bytes downloaded in fast mode") assertThat(body.itemId()).isEqualTo("item_id") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricUpdateParamsTest.kt index ed55040a..8e1ccabf 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/MetricUpdateParamsTest.kt @@ -31,7 +31,9 @@ class MetricUpdateParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.metadata()) .contains( @@ -44,7 +46,9 @@ class MetricUpdateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = MetricUpdateParams.builder().metricId("metric_id").build() + val body = params._body() + assertThat(body).isNotNull } 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 a5164320..bad219f7 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 @@ -136,7 +136,9 @@ class PlanCreateParamsTest { .netTerms(0L) .status(PlanCreateParams.Status.ACTIVE) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.currency()).isEqualTo("currency") assertThat(body.name()).isEqualTo("name") @@ -226,7 +228,9 @@ class PlanCreateParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.currency()).isEqualTo("currency") assertThat(body.name()).isEqualTo("name") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParamsTest.kt index 41a3a229..95458387 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParamsTest.kt @@ -33,7 +33,9 @@ class PlanExternalPlanIdUpdateParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.externalPlanId()).contains("external_plan_id") assertThat(body.metadata()) @@ -48,7 +50,9 @@ class PlanExternalPlanIdUpdateParamsTest { fun bodyWithoutOptionalFields() { val params = PlanExternalPlanIdUpdateParams.builder().otherExternalPlanId("external_plan_id").build() + val body = params._body() + assertThat(body).isNotNull } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanUpdateParamsTest.kt index 9cccfd74..9a8bddb3 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanUpdateParamsTest.kt @@ -33,7 +33,9 @@ class PlanUpdateParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.externalPlanId()).contains("external_plan_id") assertThat(body.metadata()) @@ -47,7 +49,9 @@ class PlanUpdateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = PlanUpdateParams.builder().planId("plan_id").build() + val body = params._body() + assertThat(body).isNotNull } 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 c11ac526..e995b89e 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 @@ -3,6 +3,7 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue +import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test class PriceCreateParamsTest { @@ -10,25 +11,27 @@ class PriceCreateParamsTest { @Test fun create() { PriceCreateParams.builder() - .forNewFloatingUnitPrice( - PriceCreateParams.NewFloatingUnitPrice.builder() - .cadence(PriceCreateParams.NewFloatingUnitPrice.Cadence.ANNUAL) + .body( + PriceCreateParams.Body.NewFloatingUnitPrice.builder() + .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) .currency("currency") .itemId("item_id") - .modelType(PriceCreateParams.NewFloatingUnitPrice.ModelType.UNIT) + .modelType(PriceCreateParams.Body.NewFloatingUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( - PriceCreateParams.NewFloatingUnitPrice.UnitConfig.builder() + PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - PriceCreateParams.NewFloatingUnitPrice.BillingCycleConfiguration.builder() + PriceCreateParams.Body.NewFloatingUnitPrice.BillingCycleConfiguration + .builder() .duration(0L) .durationUnit( - PriceCreateParams.NewFloatingUnitPrice.BillingCycleConfiguration + PriceCreateParams.Body.NewFloatingUnitPrice + .BillingCycleConfiguration .DurationUnit .DAY ) @@ -39,17 +42,19 @@ class PriceCreateParamsTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - PriceCreateParams.NewFloatingUnitPrice.InvoicingCycleConfiguration.builder() + PriceCreateParams.Body.NewFloatingUnitPrice.InvoicingCycleConfiguration + .builder() .duration(0L) .durationUnit( - PriceCreateParams.NewFloatingUnitPrice.InvoicingCycleConfiguration + PriceCreateParams.Body.NewFloatingUnitPrice + .InvoicingCycleConfiguration .DurationUnit .DAY ) .build() ) .metadata( - PriceCreateParams.NewFloatingUnitPrice.Metadata.builder() + PriceCreateParams.Body.NewFloatingUnitPrice.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) @@ -57,4 +62,158 @@ class PriceCreateParamsTest { ) .build() } + + @Test + fun body() { + val params = + PriceCreateParams.builder() + .body( + PriceCreateParams.Body.NewFloatingUnitPrice.builder() + .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() + .unitAmount("unit_amount") + .build() + ) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + PriceCreateParams.Body.NewFloatingUnitPrice.BillingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + PriceCreateParams.Body.NewFloatingUnitPrice + .BillingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .conversionRate(0.0) + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("invoice_grouping_key") + .invoicingCycleConfiguration( + PriceCreateParams.Body.NewFloatingUnitPrice.InvoicingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + PriceCreateParams.Body.NewFloatingUnitPrice + .InvoicingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .metadata( + PriceCreateParams.Body.NewFloatingUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + .build() + + val body = params._body() + + assertThat(body).isNotNull + assertThat(body) + .isEqualTo( + PriceCreateParams.Body.ofNewFloatingUnitPrice( + PriceCreateParams.Body.NewFloatingUnitPrice.builder() + .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() + .unitAmount("unit_amount") + .build() + ) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + PriceCreateParams.Body.NewFloatingUnitPrice.BillingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + PriceCreateParams.Body.NewFloatingUnitPrice + .BillingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .conversionRate(0.0) + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("invoice_grouping_key") + .invoicingCycleConfiguration( + PriceCreateParams.Body.NewFloatingUnitPrice.InvoicingCycleConfiguration + .builder() + .duration(0L) + .durationUnit( + PriceCreateParams.Body.NewFloatingUnitPrice + .InvoicingCycleConfiguration + .DurationUnit + .DAY + ) + .build() + ) + .metadata( + PriceCreateParams.Body.NewFloatingUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + ) + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + PriceCreateParams.builder() + .body( + PriceCreateParams.Body.NewFloatingUnitPrice.builder() + .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() + .unitAmount("unit_amount") + .build() + ) + .build() + ) + .build() + + val body = params._body() + + assertThat(body).isNotNull + assertThat(body) + .isEqualTo( + PriceCreateParams.Body.ofNewFloatingUnitPrice( + PriceCreateParams.Body.NewFloatingUnitPrice.builder() + .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() + .unitAmount("unit_amount") + .build() + ) + .build() + ) + ) + } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateParamsTest.kt index 92f78784..96b99d92 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateParamsTest.kt @@ -33,7 +33,9 @@ class PriceEvaluateParamsTest { .filter("my_numeric_property > 100 AND my_other_property = 'bar'") .addGroupingKey("case when my_event_type = 'foo' then true else false end") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.timeframeEnd()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(body.timeframeStart()) @@ -54,7 +56,9 @@ class PriceEvaluateParamsTest { .timeframeEnd(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .timeframeStart(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.timeframeEnd()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(body.timeframeStart()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParamsTest.kt index 9fe80ff9..7bb3757f 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParamsTest.kt @@ -31,7 +31,9 @@ class PriceExternalPriceIdUpdateParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.metadata()) .contains( @@ -45,7 +47,9 @@ class PriceExternalPriceIdUpdateParamsTest { fun bodyWithoutOptionalFields() { val params = PriceExternalPriceIdUpdateParams.builder().externalPriceId("external_price_id").build() + val body = params._body() + assertThat(body).isNotNull } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceUpdateParamsTest.kt index 550c881a..bbfa0f23 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceUpdateParamsTest.kt @@ -31,7 +31,9 @@ class PriceUpdateParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.metadata()) .contains( @@ -44,7 +46,9 @@ class PriceUpdateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = PriceUpdateParams.builder().priceId("price_id").build() + val body = params._body() + assertThat(body).isNotNull } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelParamsTest.kt index ede423d0..a0bdcf6d 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionCancelParamsTest.kt @@ -27,7 +27,9 @@ class SubscriptionCancelParamsTest { .allowInvoiceCreditOrVoid(true) .cancellationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.cancelOption()) .isEqualTo(SubscriptionCancelParams.CancelOption.END_OF_SUBSCRIPTION_TERM) @@ -43,7 +45,9 @@ class SubscriptionCancelParamsTest { .subscriptionId("subscription_id") .cancelOption(SubscriptionCancelParams.CancelOption.END_OF_SUBSCRIPTION_TERM) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.cancelOption()) .isEqualTo(SubscriptionCancelParams.CancelOption.END_OF_SUBSCRIPTION_TERM) 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 f4390096..1decacc6 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 @@ -596,7 +596,9 @@ class SubscriptionCreateParamsTest { .startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .trialDurationDays(999999L) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.addAdjustments()) .contains( @@ -918,7 +920,9 @@ class SubscriptionCreateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = SubscriptionCreateParams.builder().build() + val body = params._body() + assertThat(body).isNotNull } } 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 78d0c72a..bbfeb1b4 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 @@ -85,7 +85,7 @@ class SubscriptionFetchCostsResponseTest { Price.UnitPrice.Metadata.builder() .putAdditionalProperty( "foo", - JsonValue.from("string") + JsonValue.from("string"), ) .build() ) 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 3a52c43c..8b44d7a3 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 @@ -299,7 +299,9 @@ class SubscriptionPriceIntervalsParamsTest { .build() ) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.add()) .contains( @@ -459,7 +461,9 @@ class SubscriptionPriceIntervalsParamsTest { fun bodyWithoutOptionalFields() { val params = SubscriptionPriceIntervalsParams.builder().subscriptionId("subscription_id").build() + val body = params._body() + assertThat(body).isNotNull } 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 6ad6045b..dafe11dc 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 @@ -621,7 +621,9 @@ class SubscriptionSchedulePlanChangeParamsTest { ) .trialDurationDays(999999L) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.changeOption()) .isEqualTo(SubscriptionSchedulePlanChangeParams.ChangeOption.REQUESTED_DATE) @@ -953,7 +955,9 @@ class SubscriptionSchedulePlanChangeParamsTest { .subscriptionId("subscription_id") .changeOption(SubscriptionSchedulePlanChangeParams.ChangeOption.REQUESTED_DATE) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.changeOption()) .isEqualTo(SubscriptionSchedulePlanChangeParams.ChangeOption.REQUESTED_DATE) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParamsTest.kt index 1fa7bbed..eb3ebb65 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParamsTest.kt @@ -25,7 +25,9 @@ class SubscriptionTriggerPhaseParamsTest { .allowInvoiceCreditOrVoid(true) .effectiveDate(LocalDate.parse("2019-12-27")) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.allowInvoiceCreditOrVoid()).contains(true) assertThat(body.effectiveDate()).contains(LocalDate.parse("2019-12-27")) @@ -35,7 +37,9 @@ class SubscriptionTriggerPhaseParamsTest { fun bodyWithoutOptionalFields() { val params = SubscriptionTriggerPhaseParams.builder().subscriptionId("subscription_id").build() + val body = params._body() + assertThat(body).isNotNull } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParamsTest.kt index 10c9d955..06885eb7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParamsTest.kt @@ -22,7 +22,9 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesParamsTest { .subscriptionId("subscription_id") .priceId("price_id") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.priceId()).isEqualTo("price_id") } @@ -34,7 +36,9 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesParamsTest { .subscriptionId("subscription_id") .priceId("price_id") .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.priceId()).isEqualTo("price_id") } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParamsTest.kt index 141046ff..cdc55c27 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParamsTest.kt @@ -31,7 +31,9 @@ class SubscriptionUpdateFixedFeeQuantityParamsTest { .changeOption(SubscriptionUpdateFixedFeeQuantityParams.ChangeOption.IMMEDIATE) .effectiveDate(LocalDate.parse("2022-12-21")) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.priceId()).isEqualTo("price_id") assertThat(body.quantity()).isEqualTo(0.0) @@ -49,7 +51,9 @@ class SubscriptionUpdateFixedFeeQuantityParamsTest { .priceId("price_id") .quantity(0.0) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.priceId()).isEqualTo("price_id") assertThat(body.quantity()).isEqualTo(0.0) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateParamsTest.kt index 189843e4..a91d5af4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateParamsTest.kt @@ -39,7 +39,9 @@ class SubscriptionUpdateParamsTest { ) .netTerms(0L) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.autoCollection()).contains(true) assertThat(body.defaultInvoiceMemo()).contains("default_invoice_memo") @@ -56,7 +58,9 @@ class SubscriptionUpdateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = SubscriptionUpdateParams.builder().subscriptionId("subscription_id").build() + val body = params._body() + assertThat(body).isNotNull } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParamsTest.kt index 809a4ec4..7abcdf74 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParamsTest.kt @@ -25,7 +25,9 @@ class SubscriptionUpdateTrialParamsTest { .trialEndDate(OffsetDateTime.parse("2017-07-21T17:32:28Z")) .shift(true) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.trialEndDate()) .isEqualTo( @@ -43,7 +45,9 @@ class SubscriptionUpdateTrialParamsTest { .subscriptionId("subscription_id") .trialEndDate(OffsetDateTime.parse("2017-07-21T17:32:28Z")) .build() + val body = params._body() + assertThat(body).isNotNull assertThat(body.trialEndDate()) .isEqualTo( 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 ffb11456..6d6d1d66 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 @@ -344,7 +344,7 @@ class SubscriptionsTest { Price.UnitPrice.Metadata.builder() .putAdditionalProperty( "foo", - JsonValue.from("string") + JsonValue.from("string"), ) .build() ) @@ -479,7 +479,7 @@ class SubscriptionsTest { Price.UnitPrice.Metadata.builder() .putAdditionalProperty( "foo", - JsonValue.from("string") + JsonValue.from("string"), ) .build() ) 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 dd45efa9..a3fc88e2 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 @@ -882,7 +882,7 @@ class ErrorHandlingTest { e, 999, Headers.builder().put("Foo", "Bar").build(), - toJson(ORB_ERROR) + toJson(ORB_ERROR), ) }) } @@ -1061,7 +1061,7 @@ class ErrorHandlingTest { throwable: Throwable, statusCode: Int, headers: Headers, - responseBody: ByteArray + responseBody: ByteArray, ) { assertThat(throwable) .asInstanceOf( 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 b75a7bb1..a6808468 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 @@ -64,6 +64,8 @@ class EventServiceTest { val eventIngestResponse = eventService.ingest( EventIngestParams.builder() + .backfillId("backfill_id") + .debug(true) .addEvent( EventIngestParams.Event.builder() .eventName("event_name") @@ -74,8 +76,6 @@ class EventServiceTest { .externalCustomerId("external_customer_id") .build() ) - .backfillId("backfill_id") - .debug(true) .build() ) println(eventIngestResponse) 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 45efff3d..b17f5184 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,27 @@ class PriceServiceTest { val price = priceService.create( PriceCreateParams.builder() - .forNewFloatingUnitPrice( - PriceCreateParams.NewFloatingUnitPrice.builder() - .cadence(PriceCreateParams.NewFloatingUnitPrice.Cadence.ANNUAL) + .body( + PriceCreateParams.Body.NewFloatingUnitPrice.builder() + .cadence(PriceCreateParams.Body.NewFloatingUnitPrice.Cadence.ANNUAL) .currency("currency") .itemId("item_id") - .modelType(PriceCreateParams.NewFloatingUnitPrice.ModelType.UNIT) + .modelType(PriceCreateParams.Body.NewFloatingUnitPrice.ModelType.UNIT) .name("Annual fee") .unitConfig( - PriceCreateParams.NewFloatingUnitPrice.UnitConfig.builder() + PriceCreateParams.Body.NewFloatingUnitPrice.UnitConfig.builder() .unitAmount("unit_amount") .build() ) .billableMetricId("billable_metric_id") .billedInAdvance(true) .billingCycleConfiguration( - PriceCreateParams.NewFloatingUnitPrice.BillingCycleConfiguration + PriceCreateParams.Body.NewFloatingUnitPrice + .BillingCycleConfiguration .builder() .duration(0L) .durationUnit( - PriceCreateParams.NewFloatingUnitPrice + PriceCreateParams.Body.NewFloatingUnitPrice .BillingCycleConfiguration .DurationUnit .DAY @@ -59,11 +60,12 @@ class PriceServiceTest { .fixedPriceQuantity(0.0) .invoiceGroupingKey("invoice_grouping_key") .invoicingCycleConfiguration( - PriceCreateParams.NewFloatingUnitPrice.InvoicingCycleConfiguration + PriceCreateParams.Body.NewFloatingUnitPrice + .InvoicingCycleConfiguration .builder() .duration(0L) .durationUnit( - PriceCreateParams.NewFloatingUnitPrice + PriceCreateParams.Body.NewFloatingUnitPrice .InvoicingCycleConfiguration .DurationUnit .DAY @@ -71,7 +73,7 @@ class PriceServiceTest { .build() ) .metadata( - PriceCreateParams.NewFloatingUnitPrice.Metadata.builder() + PriceCreateParams.Body.NewFloatingUnitPrice.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/WebhookServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/WebhookServiceTest.kt index c49f932b..32414788 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/WebhookServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/WebhookServiceTest.kt @@ -75,7 +75,7 @@ internal class WebhookServiceTest { .atOffset(ZoneOffset.UTC) .format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) ), - SECRET + SECRET, ) } .isInstanceOf(OrbException::class.java) @@ -97,7 +97,7 @@ internal class WebhookServiceTest { .atOffset(ZoneOffset.UTC) .format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) ), - SECRET + SECRET, ) } .isInstanceOf(OrbException::class.java) @@ -131,7 +131,7 @@ internal class WebhookServiceTest { .verifySignature( PAYLOAD.trimIndent(), buildHeaders(signature = "$SIGNATURE v1=Zm9v"), - SECRET + SECRET, ) } .doesNotThrowAnyException() @@ -141,7 +141,7 @@ internal class WebhookServiceTest { .verifySignature( PAYLOAD.trimIndent(), buildHeaders(signature = "v1=$SIGNATURE v2=$SIGNATURE"), - SECRET + SECRET, ) } .doesNotThrowAnyException() @@ -156,7 +156,7 @@ internal class WebhookServiceTest { .verifySignature( PAYLOAD.trimIndent(), buildHeaders(signature = "v2=$SIGNATURE"), - SECRET + SECRET, ) } .isInstanceOf(OrbException::class.java) 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 a2c7c22f..8d8e6f3d 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 @@ -43,13 +43,14 @@ class LedgerServiceTest { val customerCreditLedgerCreateEntryResponse = ledgerService.createEntry( CustomerCreditLedgerCreateEntryParams.builder() - .forAddIncrementCreditLedgerEntryRequestParams( - CustomerCreditLedgerCreateEntryParams + .customerId("customer_id") + .body( + CustomerCreditLedgerCreateEntryParams.Body .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) .entryType( - CustomerCreditLedgerCreateEntryParams + CustomerCreditLedgerCreateEntryParams.Body .AddIncrementCreditLedgerEntryRequestParams .EntryType .INCREMENT @@ -59,7 +60,7 @@ class LedgerServiceTest { .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .invoiceSettings( - CustomerCreditLedgerCreateEntryParams + CustomerCreditLedgerCreateEntryParams.Body .AddIncrementCreditLedgerEntryRequestParams .InvoiceSettings .builder() @@ -70,7 +71,7 @@ class LedgerServiceTest { .build() ) .metadata( - CustomerCreditLedgerCreateEntryParams + CustomerCreditLedgerCreateEntryParams.Body .AddIncrementCreditLedgerEntryRequestParams .Metadata .builder() @@ -80,7 +81,6 @@ class LedgerServiceTest { .perUnitCostBasis("per_unit_cost_basis") .build() ) - .customerId("customer_id") .build() ) println(customerCreditLedgerCreateEntryResponse) @@ -97,13 +97,14 @@ class LedgerServiceTest { val customerCreditLedgerCreateEntryByExternalIdResponse = ledgerService.createEntryByExternalId( CustomerCreditLedgerCreateEntryByExternalIdParams.builder() - .forAddIncrementCreditLedgerEntryRequestParams( - CustomerCreditLedgerCreateEntryByExternalIdParams + .externalCustomerId("external_customer_id") + .body( + CustomerCreditLedgerCreateEntryByExternalIdParams.Body .AddIncrementCreditLedgerEntryRequestParams .builder() .amount(0.0) .entryType( - CustomerCreditLedgerCreateEntryByExternalIdParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body .AddIncrementCreditLedgerEntryRequestParams .EntryType .INCREMENT @@ -113,7 +114,7 @@ class LedgerServiceTest { .effectiveDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .expiryDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .invoiceSettings( - CustomerCreditLedgerCreateEntryByExternalIdParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body .AddIncrementCreditLedgerEntryRequestParams .InvoiceSettings .builder() @@ -124,7 +125,7 @@ class LedgerServiceTest { .build() ) .metadata( - CustomerCreditLedgerCreateEntryByExternalIdParams + CustomerCreditLedgerCreateEntryByExternalIdParams.Body .AddIncrementCreditLedgerEntryRequestParams .Metadata .builder() @@ -134,7 +135,6 @@ class LedgerServiceTest { .perUnitCostBasis("per_unit_cost_basis") .build() ) - .externalCustomerId("external_customer_id") .build() ) println(customerCreditLedgerCreateEntryByExternalIdResponse) diff --git a/scripts/format b/scripts/format index c6239fab..456a69db 100755 --- a/scripts/format +++ b/scripts/format @@ -5,4 +5,4 @@ set -e cd "$(dirname "$0")/.." echo "==> Running spotlessApply" -./gradlew --build-cache --parallel --no-daemon spotlessApply +./gradlew spotlessApply diff --git a/scripts/lint b/scripts/lint index 58753d0b..e3a5f5e2 100755 --- a/scripts/lint +++ b/scripts/lint @@ -5,4 +5,4 @@ set -e cd "$(dirname "$0")/.." echo "==> Build classes" -./gradlew --build-cache --parallel --no-daemon build testClasses -x test +./gradlew build testClasses -x test diff --git a/scripts/test b/scripts/test index 72ed0333..6b750a74 100755 --- a/scripts/test +++ b/scripts/test @@ -53,4 +53,4 @@ else fi echo "==> Running tests" -./gradlew --build-cache --parallel --no-daemon test +./gradlew test