diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d76a3e43..0837041f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,12 +7,17 @@ on: - 'integrated/**' - 'stl-preview-head/**' - 'stl-preview-base/**' + pull_request: + branches-ignore: + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: timeout-minutes: 10 name: lint runs-on: ${{ github.repository == 'stainless-sdks/orb-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 @@ -35,6 +40,7 @@ jobs: timeout-minutes: 10 name: test runs-on: ${{ github.repository == 'stainless-sdks/orb-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fea34540..2601677b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.0.0" + ".": "1.1.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 645b4c0b..090c0e18 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 116 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-c2a4808c828c8288c5c8dfe2fdfa51d4d7c1bcc33cacc6b859d0cf4b35ce95cc.yml -openapi_spec_hash: a2b5a1bfabbd03dd1b411791576eb502 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-ff68c7ee2669d61716781d01b93f34186fb7a19ff4ad6fc2c0b8f9f4d9c4a588.yml +openapi_spec_hash: 17bdc6b1ca2531dc884c6d156f404f0c config_hash: 3c3524be9607afb24d2139ce26ce5389 diff --git a/CHANGELOG.md b/CHANGELOG.md index e83af691..be3cbd1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,37 @@ # Changelog +## 1.1.0 (2025-07-02) + +Full Changelog: [v1.0.0...v1.1.0](https://github.com/orbcorp/orb-java/compare/v1.0.0...v1.1.0) + +### Features + +* **api:** api update ([91c85d4](https://github.com/orbcorp/orb-java/commit/91c85d496a9d4e2f7597a52f193df49012bfe53b)) +* **api:** api update ([e58761c](https://github.com/orbcorp/orb-java/commit/e58761cd2e36bfa66ec1f17d05428acf2299653a)) +* **api:** api update ([83c2707](https://github.com/orbcorp/orb-java/commit/83c2707bc9dd85f14df2c31e2837fd6c43e3349e)) +* **api:** api update ([614dfad](https://github.com/orbcorp/orb-java/commit/614dfad8313393787778319ff46860ad2c548aa5)) +* **client:** add a `withOptions` method ([744d7a6](https://github.com/orbcorp/orb-java/commit/744d7a67931d92a891bea1ff58140de71fca9eb8)) +* **client:** implement per-endpoint base URL support ([6172f77](https://github.com/orbcorp/orb-java/commit/6172f770b4a6ccbb41f5748aee9164f8071036d7)) + + +### Bug Fixes + +* **ci:** release-doctor — report correct token name ([d631afb](https://github.com/orbcorp/orb-java/commit/d631afbee08819fa5febba75d799ebbbc688f0b9)) +* **client:** bump max requests per host to max requests (5 -> 64) ([5576ea4](https://github.com/orbcorp/orb-java/commit/5576ea4d94771c0003e8f13d503cbef46a7c8221)) +* **client:** don't close client on `withOptions` usage when original is gc'd ([002c10d](https://github.com/orbcorp/orb-java/commit/002c10dd581d1e95da9431baf6c157c878db04d8)) + + +### Chores + +* **ci:** enable for pull requests ([ecdbbd4](https://github.com/orbcorp/orb-java/commit/ecdbbd4212a2bcb27d7ec96013d3a6487751372c)) +* **ci:** only run for pushes and fork pull requests ([cbc078a](https://github.com/orbcorp/orb-java/commit/cbc078ac5bf69fbfa3c6f165441f58cb4d493c93)) +* fix formatting ([fe0ad84](https://github.com/orbcorp/orb-java/commit/fe0ad84fdeb583979218fddfc2e17d7aeab19421)) + + +### Refactors + +* **internal:** minor `ClientOptionsTest` change ([d7614c8](https://github.com/orbcorp/orb-java/commit/d7614c8bb5048cfb430094f7ae3cc877a0627aad)) + ## 1.0.0 (2025-06-09) Full Changelog: [v0.57.0...v1.0.0](https://github.com/orbcorp/orb-java/compare/v0.57.0...v1.0.0) diff --git a/README.md b/README.md index b61134f3..f484e895 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/1.0.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/1.1.0) @@ -19,7 +19,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho ### Gradle ```kotlin -implementation("com.withorb.api:orb-java:1.0.0") +implementation("com.withorb.api:orb-java:1.1.0") ``` ### Maven @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:1.0.0") com.withorb.api orb-java - 1.0.0 + 1.1.0 ``` @@ -104,6 +104,21 @@ See this table for the available options: > Don't create more than one client in the same application. Each client has a connection pool and > thread pools, which are more efficient to share between requests. +### Modifying configuration + +To temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service: + +```java +import com.withorb.api.client.OrbClient; + +OrbClient clientWithOptions = client.withOptions(optionsBuilder -> { + optionsBuilder.baseUrl("https://example.com"); + optionsBuilder.maxRetries(42); +}); +``` + +The `withOptions()` method does not affect the original client or service. + ## Requests and responses To send a request to the Orb API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class. diff --git a/bin/check-release-environment b/bin/check-release-environment index ef2c1d07..3a6a7b4a 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -3,19 +3,19 @@ errors=() if [ -z "${SONATYPE_USERNAME}" ]; then - errors+=("The ORB_SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets") + errors+=("The SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi if [ -z "${SONATYPE_PASSWORD}" ]; then - errors+=("The ORB_SONATYPE_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") + errors+=("The SONATYPE_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi if [ -z "${GPG_SIGNING_KEY}" ]; then - errors+=("The ORB_SONATYPE_GPG_SIGNING_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets") + errors+=("The GPG_SIGNING_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi if [ -z "${GPG_SIGNING_PASSWORD}" ]; then - errors+=("The ORB_SONATYPE_GPG_SIGNING_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") + errors+=("The GPG_SIGNING_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi lenErrors=${#errors[@]} diff --git a/build.gradle.kts b/build.gradle.kts index 93c2171a..e29e10bb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.withorb.api" - version = "1.0.0" // x-release-please-version + version = "1.1.0" // x-release-please-version } 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 655da4e8..90820ecd 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 @@ -2,7 +2,6 @@ package com.withorb.api.client.okhttp import com.withorb.api.core.RequestOptions import com.withorb.api.core.Timeout -import com.withorb.api.core.checkRequired import com.withorb.api.core.http.Headers import com.withorb.api.core.http.HttpClient import com.withorb.api.core.http.HttpMethod @@ -17,7 +16,6 @@ import java.time.Duration import java.util.concurrent.CompletableFuture import okhttp3.Call import okhttp3.Callback -import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.MediaType import okhttp3.MediaType.Companion.toMediaType @@ -28,8 +26,7 @@ import okhttp3.Response import okhttp3.logging.HttpLoggingInterceptor import okio.BufferedSink -class OkHttpClient -private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) : +class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpClient) : HttpClient { override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse { @@ -140,11 +137,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val } private fun HttpRequest.toUrl(): String { - url?.let { - return it - } - - val builder = baseUrl.newBuilder() + val builder = baseUrl.toHttpUrl().newBuilder() pathSegments.forEach(builder::addPathSegment) queryParams.keys().forEach { key -> queryParams.values(key).forEach { builder.addQueryParameter(key, it) } @@ -194,12 +187,9 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val class Builder internal constructor() { - private var baseUrl: HttpUrl? = null private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null - fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl.toHttpUrl() } - fun timeout(timeout: Timeout) = apply { this.timeout = timeout } fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build()) @@ -214,8 +204,12 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val .writeTimeout(timeout.write()) .callTimeout(timeout.request()) .proxy(proxy) - .build(), - checkRequired("baseUrl", baseUrl), + .build() + .apply { + // We usually make all our requests to the same host so it makes sense to + // raise the per-host limit to the overall limit. + dispatcher.maxRequestsPerHost = dispatcher.maxRequests + } ) } } diff --git a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt index df13e8b1..f09de14d 100644 --- a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt +++ b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt @@ -176,13 +176,7 @@ class OrbOkHttpClient private constructor() { fun build(): OrbClient = OrbClientImpl( clientOptions - .httpClient( - OkHttpClient.builder() - .baseUrl(clientOptions.baseUrl()) - .timeout(timeout) - .proxy(proxy) - .build() - ) + .httpClient(OkHttpClient.builder().timeout(timeout).proxy(proxy).build()) .build() ) } diff --git a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt index b0396fb6..eb68056e 100644 --- a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt +++ b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt @@ -176,13 +176,7 @@ class OrbOkHttpClientAsync private constructor() { fun build(): OrbClientAsync = OrbClientAsyncImpl( clientOptions - .httpClient( - OkHttpClient.builder() - .baseUrl(clientOptions.baseUrl()) - .timeout(timeout) - .proxy(proxy) - .build() - ) + .httpClient(OkHttpClient.builder().timeout(timeout).proxy(proxy).build()) .build() ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt index a2a23ae8..4bdf622a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt @@ -2,6 +2,7 @@ package com.withorb.api.client +import com.withorb.api.core.ClientOptions import com.withorb.api.services.blocking.AlertService import com.withorb.api.services.blocking.BetaService import com.withorb.api.services.blocking.CouponService @@ -19,6 +20,7 @@ import com.withorb.api.services.blocking.SubscriptionChangeService import com.withorb.api.services.blocking.SubscriptionService import com.withorb.api.services.blocking.TopLevelService import com.withorb.api.services.blocking.WebhookService +import java.util.function.Consumer /** * A client for interacting with the Orb REST API synchronously. You can also switch to asynchronous @@ -49,6 +51,13 @@ interface OrbClient { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): OrbClient + fun topLevel(): TopLevelService fun beta(): BetaService @@ -99,6 +108,13 @@ interface OrbClient { /** A view of [OrbClient] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): OrbClient.WithRawResponse + fun topLevel(): TopLevelService.WithRawResponse fun beta(): BetaService.WithRawResponse diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt index 258fd0f2..b904eb55 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt @@ -2,6 +2,7 @@ package com.withorb.api.client +import com.withorb.api.core.ClientOptions import com.withorb.api.services.async.AlertServiceAsync import com.withorb.api.services.async.BetaServiceAsync import com.withorb.api.services.async.CouponServiceAsync @@ -18,6 +19,7 @@ import com.withorb.api.services.async.PriceServiceAsync import com.withorb.api.services.async.SubscriptionChangeServiceAsync import com.withorb.api.services.async.SubscriptionServiceAsync import com.withorb.api.services.async.TopLevelServiceAsync +import java.util.function.Consumer /** * A client for interacting with the Orb REST API asynchronously. You can also switch to synchronous @@ -48,6 +50,13 @@ interface OrbClientAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): OrbClientAsync + fun topLevel(): TopLevelServiceAsync fun beta(): BetaServiceAsync @@ -96,6 +105,13 @@ interface OrbClientAsync { /** A view of [OrbClientAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): OrbClientAsync.WithRawResponse + fun topLevel(): TopLevelServiceAsync.WithRawResponse fun beta(): BetaServiceAsync.WithRawResponse 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 e5e096d9..fa0e22b0 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 @@ -36,6 +36,7 @@ import com.withorb.api.services.async.SubscriptionServiceAsync import com.withorb.api.services.async.SubscriptionServiceAsyncImpl import com.withorb.api.services.async.TopLevelServiceAsync import com.withorb.api.services.async.TopLevelServiceAsyncImpl +import java.util.function.Consumer class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAsync { @@ -116,6 +117,9 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs override fun withRawResponse(): OrbClientAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): OrbClientAsync = + OrbClientAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun topLevel(): TopLevelServiceAsync = topLevel override fun beta(): BetaServiceAsync = beta @@ -219,6 +223,13 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs SubscriptionChangeServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): OrbClientAsync.WithRawResponse = + OrbClientAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun topLevel(): TopLevelServiceAsync.WithRawResponse = topLevel override fun beta(): BetaServiceAsync.WithRawResponse = beta 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 c29770c2..e3671e40 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 @@ -38,6 +38,7 @@ import com.withorb.api.services.blocking.TopLevelService import com.withorb.api.services.blocking.TopLevelServiceImpl import com.withorb.api.services.blocking.WebhookService import com.withorb.api.services.blocking.WebhookServiceImpl +import java.util.function.Consumer class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient { @@ -108,6 +109,9 @@ class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient { override fun withRawResponse(): OrbClient.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): OrbClient = + OrbClientImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun topLevel(): TopLevelService = topLevel override fun beta(): BetaService = beta @@ -211,6 +215,13 @@ class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient { SubscriptionChangeServiceImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): OrbClient.WithRawResponse = + OrbClientImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun topLevel(): TopLevelService.WithRawResponse = topLevel override fun beta(): BetaService.WithRawResponse = beta diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt index f1898f51..5710deff 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt @@ -24,7 +24,7 @@ private constructor( @get:JvmName("jsonMapper") val jsonMapper: JsonMapper, @get:JvmName("streamHandlerExecutor") val streamHandlerExecutor: Executor, @get:JvmName("clock") val clock: Clock, - @get:JvmName("baseUrl") val baseUrl: String, + private val baseUrl: String?, @get:JvmName("headers") val headers: Headers, @get:JvmName("queryParams") val queryParams: QueryParams, @get:JvmName("responseValidation") val responseValidation: Boolean, @@ -40,6 +40,8 @@ private constructor( } } + fun baseUrl(): String = baseUrl ?: PRODUCTION_URL + fun webhookSecret(): Optional = Optional.ofNullable(webhookSecret) fun toBuilder() = Builder().from(this) @@ -70,7 +72,7 @@ private constructor( private var jsonMapper: JsonMapper = jsonMapper() private var streamHandlerExecutor: Executor? = null private var clock: Clock = Clock.systemUTC() - private var baseUrl: String = PRODUCTION_URL + private var baseUrl: String? = null private var headers: Headers.Builder = Headers.builder() private var queryParams: QueryParams.Builder = QueryParams.builder() private var responseValidation: Boolean = false @@ -96,7 +98,9 @@ private constructor( webhookSecret = clientOptions.webhookSecret } - fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient } + fun httpClient(httpClient: HttpClient) = apply { + this.httpClient = PhantomReachableClosingHttpClient(httpClient) + } fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply { this.checkJacksonVersionCompatibility = checkJacksonVersionCompatibility @@ -110,7 +114,10 @@ private constructor( fun clock(clock: Clock) = apply { this.clock = clock } - fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl } + fun baseUrl(baseUrl: String?) = apply { this.baseUrl = baseUrl } + + /** Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */ + fun baseUrl(baseUrl: Optional) = baseUrl(baseUrl.getOrNull()) fun responseValidation(responseValidation: Boolean) = apply { this.responseValidation = responseValidation @@ -208,8 +215,6 @@ private constructor( fun removeAllQueryParams(keys: Set) = apply { queryParams.removeAll(keys) } - fun baseUrl(): String = baseUrl - fun fromEnv() = apply { System.getenv("ORB_BASE_URL")?.let { baseUrl(it) } System.getenv("ORB_API_KEY")?.let { apiKey(it) } @@ -252,14 +257,12 @@ private constructor( return ClientOptions( httpClient, - PhantomReachableClosingHttpClient( - RetryingHttpClient.builder() - .httpClient(httpClient) - .clock(clock) - .maxRetries(maxRetries) - .idempotencyHeader("Idempotency-Key") - .build() - ), + RetryingHttpClient.builder() + .httpClient(httpClient) + .clock(clock) + .maxRetries(maxRetries) + .idempotencyHeader("Idempotency-Key") + .build(), checkJacksonVersionCompatibility, jsonMapper, streamHandlerExecutor diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/HttpRequest.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/HttpRequest.kt index a5a3aaab..406a35d7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/HttpRequest.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/HttpRequest.kt @@ -6,7 +6,7 @@ import com.withorb.api.core.toImmutable class HttpRequest private constructor( @get:JvmName("method") val method: HttpMethod, - @get:JvmName("url") val url: String?, + @get:JvmName("baseUrl") val baseUrl: String, @get:JvmName("pathSegments") val pathSegments: List, @get:JvmName("headers") val headers: Headers, @get:JvmName("queryParams") val queryParams: QueryParams, @@ -16,7 +16,7 @@ private constructor( fun toBuilder(): Builder = Builder().from(this) override fun toString(): String = - "HttpRequest{method=$method, url=$url, pathSegments=$pathSegments, headers=$headers, queryParams=$queryParams, body=$body}" + "HttpRequest{method=$method, baseUrl=$baseUrl, pathSegments=$pathSegments, headers=$headers, queryParams=$queryParams, body=$body}" companion object { @JvmStatic fun builder() = Builder() @@ -25,7 +25,7 @@ private constructor( class Builder internal constructor() { private var method: HttpMethod? = null - private var url: String? = null + private var baseUrl: String? = null private var pathSegments: MutableList = mutableListOf() private var headers: Headers.Builder = Headers.builder() private var queryParams: QueryParams.Builder = QueryParams.builder() @@ -34,7 +34,7 @@ private constructor( @JvmSynthetic internal fun from(request: HttpRequest) = apply { method = request.method - url = request.url + baseUrl = request.baseUrl pathSegments = request.pathSegments.toMutableList() headers = request.headers.toBuilder() queryParams = request.queryParams.toBuilder() @@ -43,7 +43,7 @@ private constructor( fun method(method: HttpMethod) = apply { this.method = method } - fun url(url: String) = apply { this.url = url } + fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl } fun addPathSegment(pathSegment: String) = apply { pathSegments.add(pathSegment) } @@ -136,7 +136,7 @@ private constructor( fun build(): HttpRequest = HttpRequest( checkRequired("method", method), - url, + checkRequired("baseUrl", baseUrl), pathSegments.toImmutable(), headers.build(), queryParams.build(), 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 2bf2a5ed..a5860df1 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 @@ -232,6 +232,17 @@ private constructor( fun body(expirationChange: Body.ExpirationChange) = body(Body.ofExpirationChange(expirationChange)) + /** + * Alias for calling [body] with the following: + * ```java + * Body.ExpirationChange.builder() + * .targetExpiryDate(targetExpiryDate) + * .build() + * ``` + */ + fun expirationChangeBody(targetExpiryDate: LocalDate) = + body(Body.ExpirationChange.builder().targetExpiryDate(targetExpiryDate).build()) + /** Alias for calling [body] with `Body.ofVoid(void_)`. */ fun body(void_: Body.Void) = body(Body.ofVoid(void_)) @@ -2069,12 +2080,12 @@ private constructor( class ExpirationChange private constructor( private val entryType: JsonValue, - private val expiryDate: JsonField, private val targetExpiryDate: JsonField, private val amount: JsonField, private val blockId: JsonField, private val currency: JsonField, private val description: JsonField, + private val expiryDate: JsonField, private val metadata: JsonField, private val additionalProperties: MutableMap, ) { @@ -2082,9 +2093,6 @@ private constructor( @JsonCreator private constructor( @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), - @JsonProperty("expiry_date") - @ExcludeMissing - expiryDate: JsonField = JsonMissing.of(), @JsonProperty("target_expiry_date") @ExcludeMissing targetExpiryDate: JsonField = JsonMissing.of(), @@ -2100,17 +2108,20 @@ private constructor( @JsonProperty("description") @ExcludeMissing description: JsonField = JsonMissing.of(), + @JsonProperty("expiry_date") + @ExcludeMissing + expiryDate: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), ) : this( entryType, - expiryDate, targetExpiryDate, amount, blockId, currency, description, + expiryDate, metadata, mutableMapOf(), ) @@ -2126,14 +2137,6 @@ private constructor( */ @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType - /** - * An ISO 8601 format date that identifies the origination credit block to expire - * - * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun expiryDate(): Optional = expiryDate.getOptional("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. @@ -2182,24 +2185,22 @@ private constructor( fun description(): Optional = description.getOptional("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`. + * An ISO 8601 format date that identifies the origination credit block to expire * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun metadata(): Optional = metadata.getOptional("metadata") + fun expiryDate(): Optional = expiryDate.getOptional("expiry_date") /** - * Returns the raw JSON value of [expiryDate]. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. * - * Unlike [expiryDate], this method doesn't throw if the JSON field has an unexpected - * type. + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - @JsonProperty("expiry_date") - @ExcludeMissing - fun _expiryDate(): JsonField = expiryDate + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [targetExpiryDate]. @@ -2243,6 +2244,16 @@ private constructor( @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [expiryDate]. + * + * Unlike [expiryDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("expiry_date") + @ExcludeMissing + fun _expiryDate(): JsonField = expiryDate + /** * Returns the raw JSON value of [metadata]. * @@ -2272,7 +2283,6 @@ private constructor( * * The following fields are required: * ```java - * .expiryDate() * .targetExpiryDate() * ``` */ @@ -2283,24 +2293,24 @@ private constructor( class Builder internal constructor() { private var entryType: JsonValue = JsonValue.from("expiration_change") - 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 expiryDate: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(expirationChange: ExpirationChange) = apply { entryType = expirationChange.entryType - expiryDate = expirationChange.expiryDate targetExpiryDate = expirationChange.targetExpiryDate amount = expirationChange.amount blockId = expirationChange.blockId currency = expirationChange.currency description = expirationChange.description + expiryDate = expirationChange.expiryDate metadata = expirationChange.metadata additionalProperties = expirationChange.additionalProperties.toMutableMap() } @@ -2319,27 +2329,6 @@ private constructor( */ fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } - /** - * An ISO 8601 format date that identifies the origination credit block to expire - */ - fun expiryDate(expiryDate: OffsetDateTime?) = - expiryDate(JsonField.ofNullable(expiryDate)) - - /** Alias for calling [Builder.expiryDate] with `expiryDate.orElse(null)`. */ - fun expiryDate(expiryDate: Optional) = - expiryDate(expiryDate.getOrNull()) - - /** - * Sets [Builder.expiryDate] to an arbitrary JSON value. - * - * You should usually call [Builder.expiryDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - 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 @@ -2443,6 +2432,27 @@ private constructor( this.description = description } + /** + * An ISO 8601 format date that identifies the origination credit block to expire + */ + fun expiryDate(expiryDate: OffsetDateTime?) = + expiryDate(JsonField.ofNullable(expiryDate)) + + /** Alias for calling [Builder.expiryDate] with `expiryDate.orElse(null)`. */ + fun expiryDate(expiryDate: Optional) = + expiryDate(expiryDate.getOrNull()) + + /** + * Sets [Builder.expiryDate] to an arbitrary JSON value. + * + * You should usually call [Builder.expiryDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun expiryDate(expiryDate: JsonField) = apply { + this.expiryDate = expiryDate + } + /** * User-specified key/value pairs for the resource. Individual keys can be removed * by setting the value to `null`, and the entire metadata mapping can be cleared by @@ -2491,7 +2501,6 @@ private constructor( * * The following fields are required: * ```java - * .expiryDate() * .targetExpiryDate() * ``` * @@ -2500,12 +2509,12 @@ private constructor( fun build(): ExpirationChange = ExpirationChange( entryType, - checkRequired("expiryDate", expiryDate), checkRequired("targetExpiryDate", targetExpiryDate), amount, blockId, currency, description, + expiryDate, metadata, additionalProperties.toMutableMap(), ) @@ -2523,12 +2532,12 @@ private constructor( throw OrbInvalidDataException("'entryType' is invalid, received $it") } } - expiryDate() targetExpiryDate() amount() blockId() currency() description() + expiryDate() metadata().ifPresent { it.validate() } validated = true } @@ -2550,12 +2559,12 @@ private constructor( @JvmSynthetic internal fun validity(): Int = entryType.let { if (it == JsonValue.from("expiration_change")) 1 else 0 } + - (if (expiryDate.asKnown().isPresent) 1 else 0) + (if (targetExpiryDate.asKnown().isPresent) 1 else 0) + (if (amount.asKnown().isPresent) 1 else 0) + (if (blockId.asKnown().isPresent) 1 else 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + + (if (expiryDate.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) /** @@ -2674,17 +2683,17 @@ private constructor( return true } - return /* spotless:off */ other is ExpirationChange && entryType == other.entryType && expiryDate == other.expiryDate && targetExpiryDate == other.targetExpiryDate && amount == other.amount && blockId == other.blockId && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ExpirationChange && entryType == other.entryType && targetExpiryDate == other.targetExpiryDate && amount == other.amount && blockId == other.blockId && currency == other.currency && description == other.description && expiryDate == other.expiryDate && 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) } + private val hashCode: Int by lazy { Objects.hash(entryType, targetExpiryDate, amount, blockId, currency, description, expiryDate, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ExpirationChange{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" + "ExpirationChange{entryType=$entryType, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, expiryDate=$expiryDate, metadata=$metadata, additionalProperties=$additionalProperties}" } class Void 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 876dcb8b..8f64f8fb 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 @@ -224,6 +224,17 @@ private constructor( fun body(expirationChange: Body.ExpirationChange) = body(Body.ofExpirationChange(expirationChange)) + /** + * Alias for calling [body] with the following: + * ```java + * Body.ExpirationChange.builder() + * .targetExpiryDate(targetExpiryDate) + * .build() + * ``` + */ + fun expirationChangeBody(targetExpiryDate: LocalDate) = + body(Body.ExpirationChange.builder().targetExpiryDate(targetExpiryDate).build()) + /** Alias for calling [body] with `Body.ofVoid(void_)`. */ fun body(void_: Body.Void) = body(Body.ofVoid(void_)) @@ -2061,12 +2072,12 @@ private constructor( class ExpirationChange private constructor( private val entryType: JsonValue, - private val expiryDate: JsonField, private val targetExpiryDate: JsonField, private val amount: JsonField, private val blockId: JsonField, private val currency: JsonField, private val description: JsonField, + private val expiryDate: JsonField, private val metadata: JsonField, private val additionalProperties: MutableMap, ) { @@ -2074,9 +2085,6 @@ private constructor( @JsonCreator private constructor( @JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(), - @JsonProperty("expiry_date") - @ExcludeMissing - expiryDate: JsonField = JsonMissing.of(), @JsonProperty("target_expiry_date") @ExcludeMissing targetExpiryDate: JsonField = JsonMissing.of(), @@ -2092,17 +2100,20 @@ private constructor( @JsonProperty("description") @ExcludeMissing description: JsonField = JsonMissing.of(), + @JsonProperty("expiry_date") + @ExcludeMissing + expiryDate: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), ) : this( entryType, - expiryDate, targetExpiryDate, amount, blockId, currency, description, + expiryDate, metadata, mutableMapOf(), ) @@ -2118,14 +2129,6 @@ private constructor( */ @JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType - /** - * An ISO 8601 format date that identifies the origination credit block to expire - * - * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun expiryDate(): Optional = expiryDate.getOptional("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. @@ -2174,24 +2177,22 @@ private constructor( fun description(): Optional = description.getOptional("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`. + * An ISO 8601 format date that identifies the origination credit block to expire * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun metadata(): Optional = metadata.getOptional("metadata") + fun expiryDate(): Optional = expiryDate.getOptional("expiry_date") /** - * Returns the raw JSON value of [expiryDate]. + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. * - * Unlike [expiryDate], this method doesn't throw if the JSON field has an unexpected - * type. + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - @JsonProperty("expiry_date") - @ExcludeMissing - fun _expiryDate(): JsonField = expiryDate + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [targetExpiryDate]. @@ -2235,6 +2236,16 @@ private constructor( @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [expiryDate]. + * + * Unlike [expiryDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("expiry_date") + @ExcludeMissing + fun _expiryDate(): JsonField = expiryDate + /** * Returns the raw JSON value of [metadata]. * @@ -2264,7 +2275,6 @@ private constructor( * * The following fields are required: * ```java - * .expiryDate() * .targetExpiryDate() * ``` */ @@ -2275,24 +2285,24 @@ private constructor( class Builder internal constructor() { private var entryType: JsonValue = JsonValue.from("expiration_change") - 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 expiryDate: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(expirationChange: ExpirationChange) = apply { entryType = expirationChange.entryType - expiryDate = expirationChange.expiryDate targetExpiryDate = expirationChange.targetExpiryDate amount = expirationChange.amount blockId = expirationChange.blockId currency = expirationChange.currency description = expirationChange.description + expiryDate = expirationChange.expiryDate metadata = expirationChange.metadata additionalProperties = expirationChange.additionalProperties.toMutableMap() } @@ -2311,27 +2321,6 @@ private constructor( */ fun entryType(entryType: JsonValue) = apply { this.entryType = entryType } - /** - * An ISO 8601 format date that identifies the origination credit block to expire - */ - fun expiryDate(expiryDate: OffsetDateTime?) = - expiryDate(JsonField.ofNullable(expiryDate)) - - /** Alias for calling [Builder.expiryDate] with `expiryDate.orElse(null)`. */ - fun expiryDate(expiryDate: Optional) = - expiryDate(expiryDate.getOrNull()) - - /** - * Sets [Builder.expiryDate] to an arbitrary JSON value. - * - * You should usually call [Builder.expiryDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - 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 @@ -2435,6 +2424,27 @@ private constructor( this.description = description } + /** + * An ISO 8601 format date that identifies the origination credit block to expire + */ + fun expiryDate(expiryDate: OffsetDateTime?) = + expiryDate(JsonField.ofNullable(expiryDate)) + + /** Alias for calling [Builder.expiryDate] with `expiryDate.orElse(null)`. */ + fun expiryDate(expiryDate: Optional) = + expiryDate(expiryDate.getOrNull()) + + /** + * Sets [Builder.expiryDate] to an arbitrary JSON value. + * + * You should usually call [Builder.expiryDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun expiryDate(expiryDate: JsonField) = apply { + this.expiryDate = expiryDate + } + /** * User-specified key/value pairs for the resource. Individual keys can be removed * by setting the value to `null`, and the entire metadata mapping can be cleared by @@ -2483,7 +2493,6 @@ private constructor( * * The following fields are required: * ```java - * .expiryDate() * .targetExpiryDate() * ``` * @@ -2492,12 +2501,12 @@ private constructor( fun build(): ExpirationChange = ExpirationChange( entryType, - checkRequired("expiryDate", expiryDate), checkRequired("targetExpiryDate", targetExpiryDate), amount, blockId, currency, description, + expiryDate, metadata, additionalProperties.toMutableMap(), ) @@ -2515,12 +2524,12 @@ private constructor( throw OrbInvalidDataException("'entryType' is invalid, received $it") } } - expiryDate() targetExpiryDate() amount() blockId() currency() description() + expiryDate() metadata().ifPresent { it.validate() } validated = true } @@ -2542,12 +2551,12 @@ private constructor( @JvmSynthetic internal fun validity(): Int = entryType.let { if (it == JsonValue.from("expiration_change")) 1 else 0 } + - (if (expiryDate.asKnown().isPresent) 1 else 0) + (if (targetExpiryDate.asKnown().isPresent) 1 else 0) + (if (amount.asKnown().isPresent) 1 else 0) + (if (blockId.asKnown().isPresent) 1 else 0) + (if (currency.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + + (if (expiryDate.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) /** @@ -2666,17 +2675,17 @@ private constructor( return true } - return /* spotless:off */ other is ExpirationChange && entryType == other.entryType && expiryDate == other.expiryDate && targetExpiryDate == other.targetExpiryDate && amount == other.amount && blockId == other.blockId && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ExpirationChange && entryType == other.entryType && targetExpiryDate == other.targetExpiryDate && amount == other.amount && blockId == other.blockId && currency == other.currency && description == other.description && expiryDate == other.expiryDate && 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) } + private val hashCode: Int by lazy { Objects.hash(entryType, targetExpiryDate, amount, blockId, currency, description, expiryDate, metadata, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ExpirationChange{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}" + "ExpirationChange{entryType=$entryType, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, expiryDate=$expiryDate, metadata=$metadata, additionalProperties=$additionalProperties}" } class Void 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 34c8fbe9..7ccfc99d 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 @@ -4085,9 +4085,12 @@ private constructor( fun creditsApplied(): String = creditsApplied.getRequired("credits_applied") /** + * This field is deprecated in favor of `adjustments` + * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ + @Deprecated("deprecated") fun discount(): Optional = discount.getOptional("discount") /** @@ -4283,7 +4286,10 @@ private constructor( * * Unlike [discount], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("discount") @ExcludeMissing fun _discount(): JsonField = discount + @Deprecated("deprecated") + @JsonProperty("discount") + @ExcludeMissing + fun _discount(): JsonField = discount /** * Returns the raw JSON value of [endDate]. @@ -4643,9 +4649,12 @@ private constructor( this.creditsApplied = creditsApplied } + /** This field is deprecated in favor of `adjustments` */ + @Deprecated("deprecated") fun discount(discount: Discount?) = discount(JsonField.ofNullable(discount)) /** Alias for calling [Builder.discount] with `discount.orElse(null)`. */ + @Deprecated("deprecated") fun discount(discount: Optional) = discount(discount.getOrNull()) /** @@ -4655,9 +4664,11 @@ private constructor( * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ + @Deprecated("deprecated") fun discount(discount: JsonField) = apply { this.discount = discount } /** Alias for calling [discount] with `Discount.ofPercentage(percentage)`. */ + @Deprecated("deprecated") fun discount(percentage: PercentageDiscount) = discount(Discount.ofPercentage(percentage)) @@ -4670,6 +4681,7 @@ private constructor( * .build() * ``` */ + @Deprecated("deprecated") fun percentageDiscount(percentageDiscount: Double) = discount( PercentageDiscount.builder() @@ -4679,9 +4691,11 @@ private constructor( ) /** Alias for calling [discount] with `Discount.ofTrial(trial)`. */ + @Deprecated("deprecated") fun discount(trial: TrialDiscount) = discount(Discount.ofTrial(trial)) /** Alias for calling [discount] with `Discount.ofUsage(usage)`. */ + @Deprecated("deprecated") fun discount(usage: UsageDiscount) = discount(Discount.ofUsage(usage)) /** @@ -4693,6 +4707,7 @@ private constructor( * .build() * ``` */ + @Deprecated("deprecated") fun usageDiscount(usageDiscount: Double) = discount( UsageDiscount.builder() @@ -4702,6 +4717,7 @@ private constructor( ) /** Alias for calling [discount] with `Discount.ofAmount(amount)`. */ + @Deprecated("deprecated") fun discount(amount: AmountDiscount) = discount(Discount.ofAmount(amount)) /** @@ -4713,6 +4729,7 @@ private constructor( * .build() * ``` */ + @Deprecated("deprecated") fun amountDiscount(amountDiscount: String) = discount( AmountDiscount.builder() 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 f7214836..7c33d0ac 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 @@ -4079,9 +4079,12 @@ private constructor( fun creditsApplied(): String = creditsApplied.getRequired("credits_applied") /** + * This field is deprecated in favor of `adjustments` + * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ + @Deprecated("deprecated") fun discount(): Optional = discount.getOptional("discount") /** @@ -4277,7 +4280,10 @@ private constructor( * * Unlike [discount], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("discount") @ExcludeMissing fun _discount(): JsonField = discount + @Deprecated("deprecated") + @JsonProperty("discount") + @ExcludeMissing + fun _discount(): JsonField = discount /** * Returns the raw JSON value of [endDate]. @@ -4637,9 +4643,12 @@ private constructor( this.creditsApplied = creditsApplied } + /** This field is deprecated in favor of `adjustments` */ + @Deprecated("deprecated") fun discount(discount: Discount?) = discount(JsonField.ofNullable(discount)) /** Alias for calling [Builder.discount] with `discount.orElse(null)`. */ + @Deprecated("deprecated") fun discount(discount: Optional) = discount(discount.getOrNull()) /** @@ -4649,9 +4658,11 @@ private constructor( * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ + @Deprecated("deprecated") fun discount(discount: JsonField) = apply { this.discount = discount } /** Alias for calling [discount] with `Discount.ofPercentage(percentage)`. */ + @Deprecated("deprecated") fun discount(percentage: PercentageDiscount) = discount(Discount.ofPercentage(percentage)) @@ -4664,6 +4675,7 @@ private constructor( * .build() * ``` */ + @Deprecated("deprecated") fun percentageDiscount(percentageDiscount: Double) = discount( PercentageDiscount.builder() @@ -4673,9 +4685,11 @@ private constructor( ) /** Alias for calling [discount] with `Discount.ofTrial(trial)`. */ + @Deprecated("deprecated") fun discount(trial: TrialDiscount) = discount(Discount.ofTrial(trial)) /** Alias for calling [discount] with `Discount.ofUsage(usage)`. */ + @Deprecated("deprecated") fun discount(usage: UsageDiscount) = discount(Discount.ofUsage(usage)) /** @@ -4687,6 +4701,7 @@ private constructor( * .build() * ``` */ + @Deprecated("deprecated") fun usageDiscount(usageDiscount: Double) = discount( UsageDiscount.builder() @@ -4696,6 +4711,7 @@ private constructor( ) /** Alias for calling [discount] with `Discount.ofAmount(amount)`. */ + @Deprecated("deprecated") fun discount(amount: AmountDiscount) = discount(Discount.ofAmount(amount)) /** @@ -4707,6 +4723,7 @@ private constructor( * .build() * ``` */ + @Deprecated("deprecated") fun amountDiscount(amountDiscount: String) = discount( AmountDiscount.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 d2dbbc9b..89e6b926 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 @@ -174,10 +174,12 @@ private constructor( fun creditsApplied(): String = creditsApplied.getRequired("credits_applied") /** + * This field is deprecated in favor of `adjustments` + * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server * responded with an unexpected value). */ - fun discount(): Optional = discount.getOptional("discount") + @Deprecated("deprecated") fun discount(): Optional = discount.getOptional("discount") /** * The end date of the range of time applied for this line item's price. @@ -370,7 +372,10 @@ private constructor( * * Unlike [discount], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("discount") @ExcludeMissing fun _discount(): JsonField = discount + @Deprecated("deprecated") + @JsonProperty("discount") + @ExcludeMissing + fun _discount(): JsonField = discount /** * Returns the raw JSON value of [endDate]. @@ -720,9 +725,12 @@ private constructor( this.creditsApplied = creditsApplied } + /** This field is deprecated in favor of `adjustments` */ + @Deprecated("deprecated") fun discount(discount: Discount?) = discount(JsonField.ofNullable(discount)) /** Alias for calling [Builder.discount] with `discount.orElse(null)`. */ + @Deprecated("deprecated") fun discount(discount: Optional) = discount(discount.getOrNull()) /** @@ -732,9 +740,11 @@ private constructor( * This method is primarily for setting the field to an undocumented or not yet supported * value. */ + @Deprecated("deprecated") fun discount(discount: JsonField) = apply { this.discount = discount } /** Alias for calling [discount] with `Discount.ofPercentage(percentage)`. */ + @Deprecated("deprecated") fun discount(percentage: PercentageDiscount) = discount(Discount.ofPercentage(percentage)) /** @@ -746,6 +756,7 @@ private constructor( * .build() * ``` */ + @Deprecated("deprecated") fun percentageDiscount(percentageDiscount: Double) = discount( PercentageDiscount.builder() @@ -755,9 +766,11 @@ private constructor( ) /** Alias for calling [discount] with `Discount.ofTrial(trial)`. */ + @Deprecated("deprecated") fun discount(trial: TrialDiscount) = discount(Discount.ofTrial(trial)) /** Alias for calling [discount] with `Discount.ofUsage(usage)`. */ + @Deprecated("deprecated") fun discount(usage: UsageDiscount) = discount(Discount.ofUsage(usage)) /** @@ -769,6 +782,7 @@ private constructor( * .build() * ``` */ + @Deprecated("deprecated") fun usageDiscount(usageDiscount: Double) = discount( UsageDiscount.builder() @@ -778,6 +792,7 @@ private constructor( ) /** Alias for calling [discount] with `Discount.ofAmount(amount)`. */ + @Deprecated("deprecated") fun discount(amount: AmountDiscount) = discount(Discount.ofAmount(amount)) /** @@ -789,6 +804,7 @@ private constructor( * .build() * ``` */ + @Deprecated("deprecated") fun amountDiscount(amountDiscount: String) = discount( AmountDiscount.builder() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryAmountDiscountAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryAmountDiscountAdjustment.kt index 24516aca..7ceb9fd9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryAmountDiscountAdjustment.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryAmountDiscountAdjustment.kt @@ -30,6 +30,7 @@ private constructor( private val filters: JsonField>, private val isInvoiceLevel: JsonField, private val reason: JsonField, + private val replacesAdjustmentId: JsonField, private val additionalProperties: MutableMap, ) { @@ -53,6 +54,9 @@ private constructor( @ExcludeMissing isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + replacesAdjustmentId: JsonField = JsonMissing.of(), ) : this( id, adjustmentType, @@ -62,6 +66,7 @@ private constructor( filters, isInvoiceLevel, reason, + replacesAdjustmentId, mutableMapOf(), ) @@ -128,6 +133,16 @@ private constructor( */ fun reason(): Optional = reason.getOptional("reason") + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun replacesAdjustmentId(): Optional = + replacesAdjustmentId.getOptional("replaces_adjustment_id") + /** * Returns the raw JSON value of [id]. * @@ -196,6 +211,16 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [replacesAdjustmentId]. + * + * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -224,6 +249,7 @@ private constructor( * .filters() * .isInvoiceLevel() * .reason() + * .replacesAdjustmentId() * ``` */ @JvmStatic fun builder() = Builder() @@ -240,6 +266,7 @@ private constructor( private var filters: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var reason: JsonField? = null + private var replacesAdjustmentId: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -254,6 +281,7 @@ private constructor( filters = monetaryAmountDiscountAdjustment.filters.map { it.toMutableList() } isInvoiceLevel = monetaryAmountDiscountAdjustment.isInvoiceLevel reason = monetaryAmountDiscountAdjustment.reason + replacesAdjustmentId = monetaryAmountDiscountAdjustment.replacesAdjustmentId additionalProperties = monetaryAmountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -397,6 +425,31 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + */ + fun replacesAdjustmentId(replacesAdjustmentId: String?) = + replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId)) + + /** + * Alias for calling [Builder.replacesAdjustmentId] with + * `replacesAdjustmentId.orElse(null)`. + */ + fun replacesAdjustmentId(replacesAdjustmentId: Optional) = + replacesAdjustmentId(replacesAdjustmentId.getOrNull()) + + /** + * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply { + this.replacesAdjustmentId = replacesAdjustmentId + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -431,6 +484,7 @@ private constructor( * .filters() * .isInvoiceLevel() * .reason() + * .replacesAdjustmentId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -445,6 +499,7 @@ private constructor( checkRequired("filters", filters).map { it.toImmutable() }, checkRequired("isInvoiceLevel", isInvoiceLevel), checkRequired("reason", reason), + checkRequired("replacesAdjustmentId", replacesAdjustmentId), additionalProperties.toMutableMap(), ) } @@ -464,6 +519,7 @@ private constructor( filters().forEach { it.validate() } isInvoiceLevel() reason() + replacesAdjustmentId() validated = true } @@ -489,7 +545,8 @@ private constructor( (appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) + (filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + - (if (reason.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + + (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0) class AdjustmentType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -618,15 +675,15 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryAmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MonetaryAmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, amountDiscount, appliesToPriceIds, filters, isInvoiceLevel, reason, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, amountDiscount, appliesToPriceIds, filters, isInvoiceLevel, reason, replacesAdjustmentId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, reason=$reason, additionalProperties=$additionalProperties}" + "MonetaryAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMaximumAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMaximumAdjustment.kt index 2862d922..74e8ff45 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMaximumAdjustment.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMaximumAdjustment.kt @@ -30,6 +30,7 @@ private constructor( private val isInvoiceLevel: JsonField, private val maximumAmount: JsonField, private val reason: JsonField, + private val replacesAdjustmentId: JsonField, private val additionalProperties: MutableMap, ) { @@ -53,6 +54,9 @@ private constructor( @ExcludeMissing maximumAmount: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + replacesAdjustmentId: JsonField = JsonMissing.of(), ) : this( id, adjustmentType, @@ -62,6 +66,7 @@ private constructor( isInvoiceLevel, maximumAmount, reason, + replacesAdjustmentId, mutableMapOf(), ) @@ -128,6 +133,16 @@ private constructor( */ fun reason(): Optional = reason.getOptional("reason") + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun replacesAdjustmentId(): Optional = + replacesAdjustmentId.getOptional("replaces_adjustment_id") + /** * Returns the raw JSON value of [id]. * @@ -196,6 +211,16 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [replacesAdjustmentId]. + * + * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -223,6 +248,7 @@ private constructor( * .isInvoiceLevel() * .maximumAmount() * .reason() + * .replacesAdjustmentId() * ``` */ @JvmStatic fun builder() = Builder() @@ -239,6 +265,7 @@ private constructor( private var isInvoiceLevel: JsonField? = null private var maximumAmount: JsonField? = null private var reason: JsonField? = null + private var replacesAdjustmentId: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -252,6 +279,7 @@ private constructor( isInvoiceLevel = monetaryMaximumAdjustment.isInvoiceLevel maximumAmount = monetaryMaximumAdjustment.maximumAmount reason = monetaryMaximumAdjustment.reason + replacesAdjustmentId = monetaryMaximumAdjustment.replacesAdjustmentId additionalProperties = monetaryMaximumAdjustment.additionalProperties.toMutableMap() } @@ -394,6 +422,31 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + */ + fun replacesAdjustmentId(replacesAdjustmentId: String?) = + replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId)) + + /** + * Alias for calling [Builder.replacesAdjustmentId] with + * `replacesAdjustmentId.orElse(null)`. + */ + fun replacesAdjustmentId(replacesAdjustmentId: Optional) = + replacesAdjustmentId(replacesAdjustmentId.getOrNull()) + + /** + * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply { + this.replacesAdjustmentId = replacesAdjustmentId + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -428,6 +481,7 @@ private constructor( * .isInvoiceLevel() * .maximumAmount() * .reason() + * .replacesAdjustmentId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -442,6 +496,7 @@ private constructor( checkRequired("isInvoiceLevel", isInvoiceLevel), checkRequired("maximumAmount", maximumAmount), checkRequired("reason", reason), + checkRequired("replacesAdjustmentId", replacesAdjustmentId), additionalProperties.toMutableMap(), ) } @@ -461,6 +516,7 @@ private constructor( isInvoiceLevel() maximumAmount() reason() + replacesAdjustmentId() validated = true } @@ -486,7 +542,8 @@ private constructor( (filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + - (if (reason.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + + (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0) class AdjustmentType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -615,15 +672,15 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryMaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MonetaryMaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, maximumAmount, reason, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, maximumAmount, reason, replacesAdjustmentId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, reason=$reason, additionalProperties=$additionalProperties}" + "MonetaryMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMinimumAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMinimumAdjustment.kt index d03c30a5..5411af3b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMinimumAdjustment.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMinimumAdjustment.kt @@ -31,6 +31,7 @@ private constructor( private val itemId: JsonField, private val minimumAmount: JsonField, private val reason: JsonField, + private val replacesAdjustmentId: JsonField, private val additionalProperties: MutableMap, ) { @@ -55,6 +56,9 @@ private constructor( @ExcludeMissing minimumAmount: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + replacesAdjustmentId: JsonField = JsonMissing.of(), ) : this( id, adjustmentType, @@ -65,6 +69,7 @@ private constructor( itemId, minimumAmount, reason, + replacesAdjustmentId, mutableMapOf(), ) @@ -139,6 +144,16 @@ private constructor( */ fun reason(): Optional = reason.getOptional("reason") + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun replacesAdjustmentId(): Optional = + replacesAdjustmentId.getOptional("replaces_adjustment_id") + /** * Returns the raw JSON value of [id]. * @@ -214,6 +229,16 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [replacesAdjustmentId]. + * + * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -242,6 +267,7 @@ private constructor( * .itemId() * .minimumAmount() * .reason() + * .replacesAdjustmentId() * ``` */ @JvmStatic fun builder() = Builder() @@ -259,6 +285,7 @@ private constructor( private var itemId: JsonField? = null private var minimumAmount: JsonField? = null private var reason: JsonField? = null + private var replacesAdjustmentId: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -273,6 +300,7 @@ private constructor( itemId = monetaryMinimumAdjustment.itemId minimumAmount = monetaryMinimumAdjustment.minimumAmount reason = monetaryMinimumAdjustment.reason + replacesAdjustmentId = monetaryMinimumAdjustment.replacesAdjustmentId additionalProperties = monetaryMinimumAdjustment.additionalProperties.toMutableMap() } @@ -426,6 +454,31 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + */ + fun replacesAdjustmentId(replacesAdjustmentId: String?) = + replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId)) + + /** + * Alias for calling [Builder.replacesAdjustmentId] with + * `replacesAdjustmentId.orElse(null)`. + */ + fun replacesAdjustmentId(replacesAdjustmentId: Optional) = + replacesAdjustmentId(replacesAdjustmentId.getOrNull()) + + /** + * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply { + this.replacesAdjustmentId = replacesAdjustmentId + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -461,6 +514,7 @@ private constructor( * .itemId() * .minimumAmount() * .reason() + * .replacesAdjustmentId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -476,6 +530,7 @@ private constructor( checkRequired("itemId", itemId), checkRequired("minimumAmount", minimumAmount), checkRequired("reason", reason), + checkRequired("replacesAdjustmentId", replacesAdjustmentId), additionalProperties.toMutableMap(), ) } @@ -496,6 +551,7 @@ private constructor( itemId() minimumAmount() reason() + replacesAdjustmentId() validated = true } @@ -522,7 +578,8 @@ private constructor( (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (itemId.asKnown().isPresent) 1 else 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + - (if (reason.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + + (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0) class AdjustmentType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -651,15 +708,15 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryMinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MonetaryMinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, itemId, minimumAmount, reason, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, itemId, minimumAmount, reason, replacesAdjustmentId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, reason=$reason, additionalProperties=$additionalProperties}" + "MonetaryMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryPercentageDiscountAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryPercentageDiscountAdjustment.kt index 41b8c741..88586711 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryPercentageDiscountAdjustment.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryPercentageDiscountAdjustment.kt @@ -30,6 +30,7 @@ private constructor( private val isInvoiceLevel: JsonField, private val percentageDiscount: JsonField, private val reason: JsonField, + private val replacesAdjustmentId: JsonField, private val additionalProperties: MutableMap, ) { @@ -53,6 +54,9 @@ private constructor( @ExcludeMissing percentageDiscount: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + replacesAdjustmentId: JsonField = JsonMissing.of(), ) : this( id, adjustmentType, @@ -62,6 +66,7 @@ private constructor( isInvoiceLevel, percentageDiscount, reason, + replacesAdjustmentId, mutableMapOf(), ) @@ -128,6 +133,16 @@ private constructor( */ fun reason(): Optional = reason.getOptional("reason") + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun replacesAdjustmentId(): Optional = + replacesAdjustmentId.getOptional("replaces_adjustment_id") + /** * Returns the raw JSON value of [id]. * @@ -197,6 +212,16 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [replacesAdjustmentId]. + * + * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -225,6 +250,7 @@ private constructor( * .isInvoiceLevel() * .percentageDiscount() * .reason() + * .replacesAdjustmentId() * ``` */ @JvmStatic fun builder() = Builder() @@ -241,6 +267,7 @@ private constructor( private var isInvoiceLevel: JsonField? = null private var percentageDiscount: JsonField? = null private var reason: JsonField? = null + private var replacesAdjustmentId: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -256,6 +283,7 @@ private constructor( isInvoiceLevel = monetaryPercentageDiscountAdjustment.isInvoiceLevel percentageDiscount = monetaryPercentageDiscountAdjustment.percentageDiscount reason = monetaryPercentageDiscountAdjustment.reason + replacesAdjustmentId = monetaryPercentageDiscountAdjustment.replacesAdjustmentId additionalProperties = monetaryPercentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -400,6 +428,31 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + */ + fun replacesAdjustmentId(replacesAdjustmentId: String?) = + replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId)) + + /** + * Alias for calling [Builder.replacesAdjustmentId] with + * `replacesAdjustmentId.orElse(null)`. + */ + fun replacesAdjustmentId(replacesAdjustmentId: Optional) = + replacesAdjustmentId(replacesAdjustmentId.getOrNull()) + + /** + * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply { + this.replacesAdjustmentId = replacesAdjustmentId + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -434,6 +487,7 @@ private constructor( * .isInvoiceLevel() * .percentageDiscount() * .reason() + * .replacesAdjustmentId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -448,6 +502,7 @@ private constructor( checkRequired("isInvoiceLevel", isInvoiceLevel), checkRequired("percentageDiscount", percentageDiscount), checkRequired("reason", reason), + checkRequired("replacesAdjustmentId", replacesAdjustmentId), additionalProperties.toMutableMap(), ) } @@ -467,6 +522,7 @@ private constructor( isInvoiceLevel() percentageDiscount() reason() + replacesAdjustmentId() validated = true } @@ -492,7 +548,8 @@ private constructor( (filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + - (if (reason.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + + (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0) class AdjustmentType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -621,15 +678,15 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryPercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MonetaryPercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, percentageDiscount, reason, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, percentageDiscount, reason, replacesAdjustmentId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryPercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, reason=$reason, additionalProperties=$additionalProperties}" + "MonetaryPercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryUsageDiscountAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryUsageDiscountAdjustment.kt index f1fc3f66..d6010e91 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryUsageDiscountAdjustment.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryUsageDiscountAdjustment.kt @@ -29,6 +29,7 @@ private constructor( private val filters: JsonField>, private val isInvoiceLevel: JsonField, private val reason: JsonField, + private val replacesAdjustmentId: JsonField, private val usageDiscount: JsonField, private val additionalProperties: MutableMap, ) { @@ -50,6 +51,9 @@ private constructor( @ExcludeMissing isInvoiceLevel: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + replacesAdjustmentId: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing usageDiscount: JsonField = JsonMissing.of(), @@ -61,6 +65,7 @@ private constructor( filters, isInvoiceLevel, reason, + replacesAdjustmentId, usageDiscount, mutableMapOf(), ) @@ -119,6 +124,16 @@ private constructor( */ fun reason(): Optional = reason.getOptional("reason") + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun replacesAdjustmentId(): Optional = + replacesAdjustmentId.getOptional("replaces_adjustment_id") + /** * The number of usage units by which to discount the price this adjustment applies to in a * given billing period. @@ -187,6 +202,16 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [replacesAdjustmentId]. + * + * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId + /** * Returns the raw JSON value of [usageDiscount]. * @@ -223,6 +248,7 @@ private constructor( * .filters() * .isInvoiceLevel() * .reason() + * .replacesAdjustmentId() * .usageDiscount() * ``` */ @@ -239,6 +265,7 @@ private constructor( private var filters: JsonField>? = null private var isInvoiceLevel: JsonField? = null private var reason: JsonField? = null + private var replacesAdjustmentId: JsonField? = null private var usageDiscount: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -253,6 +280,7 @@ private constructor( filters = monetaryUsageDiscountAdjustment.filters.map { it.toMutableList() } isInvoiceLevel = monetaryUsageDiscountAdjustment.isInvoiceLevel reason = monetaryUsageDiscountAdjustment.reason + replacesAdjustmentId = monetaryUsageDiscountAdjustment.replacesAdjustmentId usageDiscount = monetaryUsageDiscountAdjustment.usageDiscount additionalProperties = monetaryUsageDiscountAdjustment.additionalProperties.toMutableMap() @@ -380,6 +408,31 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + */ + fun replacesAdjustmentId(replacesAdjustmentId: String?) = + replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId)) + + /** + * Alias for calling [Builder.replacesAdjustmentId] with + * `replacesAdjustmentId.orElse(null)`. + */ + fun replacesAdjustmentId(replacesAdjustmentId: Optional) = + replacesAdjustmentId(replacesAdjustmentId.getOrNull()) + + /** + * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply { + this.replacesAdjustmentId = replacesAdjustmentId + } + /** * The number of usage units by which to discount the price this adjustment applies to in a * given billing period. @@ -430,6 +483,7 @@ private constructor( * .filters() * .isInvoiceLevel() * .reason() + * .replacesAdjustmentId() * .usageDiscount() * ``` * @@ -444,6 +498,7 @@ private constructor( checkRequired("filters", filters).map { it.toImmutable() }, checkRequired("isInvoiceLevel", isInvoiceLevel), checkRequired("reason", reason), + checkRequired("replacesAdjustmentId", replacesAdjustmentId), checkRequired("usageDiscount", usageDiscount), additionalProperties.toMutableMap(), ) @@ -463,6 +518,7 @@ private constructor( filters().forEach { it.validate() } isInvoiceLevel() reason() + replacesAdjustmentId() usageDiscount() validated = true } @@ -489,6 +545,7 @@ private constructor( (filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + + (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) class AdjustmentType @JsonCreator private constructor(private val value: JsonField) : @@ -618,15 +675,15 @@ private constructor( return true } - return /* spotless:off */ other is MonetaryUsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MonetaryUsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, reason, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, reason, replacesAdjustmentId, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MonetaryUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "MonetaryUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBpsPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBpsPrice.kt index ddc7d1f5..1bb29b70 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBpsPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBpsPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( bpsConfig, cadence, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -259,6 +264,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [bpsConfig]. * @@ -408,6 +422,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -460,6 +483,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -481,6 +505,7 @@ private constructor( invoiceGroupingKey = newPlanBpsPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanBpsPrice.invoicingCycleConfiguration metadata = newPlanBpsPrice.metadata + referenceId = newPlanBpsPrice.referenceId additionalProperties = newPlanBpsPrice.additionalProperties.toMutableMap() } @@ -858,6 +883,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -912,6 +955,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -940,6 +984,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -974,7 +1019,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1534,15 +1580,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanBpsPrice && bpsConfig == other.bpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanBpsPrice && bpsConfig == other.bpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanBpsPrice{bpsConfig=$bpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanBpsPrice{bpsConfig=$bpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkBpsPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkBpsPrice.kt index b19a14ee..5d49f502 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkBpsPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkBpsPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( bulkBpsConfig, cadence, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -259,6 +264,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [bulkBpsConfig]. * @@ -410,6 +424,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -462,6 +485,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -483,6 +507,7 @@ private constructor( invoiceGroupingKey = newPlanBulkBpsPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanBulkBpsPrice.invoicingCycleConfiguration metadata = newPlanBulkBpsPrice.metadata + referenceId = newPlanBulkBpsPrice.referenceId additionalProperties = newPlanBulkBpsPrice.additionalProperties.toMutableMap() } @@ -862,6 +887,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -916,6 +959,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -944,6 +988,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -978,7 +1023,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1538,15 +1584,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanBulkBpsPrice && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanBulkBpsPrice && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanBulkBpsPrice{bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanBulkBpsPrice{bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkPrice.kt index 0ea7ac5a..bd9f78b4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( bulkConfig, cadence, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -259,6 +264,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [bulkConfig]. * @@ -410,6 +424,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -462,6 +485,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -483,6 +507,7 @@ private constructor( invoiceGroupingKey = newPlanBulkPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanBulkPrice.invoicingCycleConfiguration metadata = newPlanBulkPrice.metadata + referenceId = newPlanBulkPrice.referenceId additionalProperties = newPlanBulkPrice.additionalProperties.toMutableMap() } @@ -860,6 +885,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -914,6 +957,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -942,6 +986,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -976,7 +1021,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1536,15 +1582,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanBulkPrice && bulkConfig == other.bulkConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanBulkPrice && bulkConfig == other.bulkConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(bulkConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanBulkPrice{bulkConfig=$bulkConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanBulkPrice{bulkConfig=$bulkConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkWithProrationPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkWithProrationPrice.kt index 9b9efc6c..1a79d7bd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkWithProrationPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkWithProrationPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( bulkWithProrationConfig, cadence, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [bulkWithProrationConfig]. * @@ -412,6 +426,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -465,6 +488,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -487,6 +511,7 @@ private constructor( invoiceGroupingKey = newPlanBulkWithProrationPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanBulkWithProrationPrice.invoicingCycleConfiguration metadata = newPlanBulkWithProrationPrice.metadata + referenceId = newPlanBulkWithProrationPrice.referenceId additionalProperties = newPlanBulkWithProrationPrice.additionalProperties.toMutableMap() } @@ -868,6 +893,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -922,6 +965,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -950,6 +994,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -984,7 +1029,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) class BulkWithProrationConfig @JsonCreator @@ -1649,15 +1695,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanBulkWithProrationPrice && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanBulkWithProrationPrice && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(bulkWithProrationConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(bulkWithProrationConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanBulkWithProrationPrice{bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanBulkWithProrationPrice{bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanCumulativeGroupedBulkPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanCumulativeGroupedBulkPrice.kt index 69f7b2f6..02e6a5b6 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanCumulativeGroupedBulkPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanCumulativeGroupedBulkPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, cumulativeGroupedBulkConfig, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -413,6 +427,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -466,6 +489,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -492,6 +516,7 @@ private constructor( invoicingCycleConfiguration = newPlanCumulativeGroupedBulkPrice.invoicingCycleConfiguration metadata = newPlanCumulativeGroupedBulkPrice.metadata + referenceId = newPlanCumulativeGroupedBulkPrice.referenceId additionalProperties = newPlanCumulativeGroupedBulkPrice.additionalProperties.toMutableMap() } @@ -873,6 +898,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -927,6 +970,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -955,6 +999,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -989,7 +1034,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1656,15 +1702,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanCumulativeGroupedBulkPrice && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanCumulativeGroupedBulkPrice && cadence == other.cadence && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, cumulativeGroupedBulkConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, cumulativeGroupedBulkConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanCumulativeGroupedBulkPrice{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanCumulativeGroupedBulkPrice{cadence=$cadence, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedAllocationPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedAllocationPrice.kt index 81035330..11518450 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedAllocationPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedAllocationPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, groupedAllocationConfig, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -412,6 +426,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -465,6 +488,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -487,6 +511,7 @@ private constructor( invoiceGroupingKey = newPlanGroupedAllocationPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanGroupedAllocationPrice.invoicingCycleConfiguration metadata = newPlanGroupedAllocationPrice.metadata + referenceId = newPlanGroupedAllocationPrice.referenceId additionalProperties = newPlanGroupedAllocationPrice.additionalProperties.toMutableMap() } @@ -868,6 +893,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -922,6 +965,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -950,6 +994,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -984,7 +1029,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1649,15 +1695,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanGroupedAllocationPrice && cadence == other.cadence && groupedAllocationConfig == other.groupedAllocationConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanGroupedAllocationPrice && cadence == other.cadence && groupedAllocationConfig == other.groupedAllocationConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, groupedAllocationConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedAllocationConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanGroupedAllocationPrice{cadence=$cadence, groupedAllocationConfig=$groupedAllocationConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanGroupedAllocationPrice{cadence=$cadence, groupedAllocationConfig=$groupedAllocationConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedTieredPackagePrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedTieredPackagePrice.kt index 312e9064..c2351467 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedTieredPackagePrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedTieredPackagePrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, groupedTieredPackageConfig, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -413,6 +427,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -466,6 +489,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -492,6 +516,7 @@ private constructor( invoicingCycleConfiguration = newPlanGroupedTieredPackagePrice.invoicingCycleConfiguration metadata = newPlanGroupedTieredPackagePrice.metadata + referenceId = newPlanGroupedTieredPackagePrice.referenceId additionalProperties = newPlanGroupedTieredPackagePrice.additionalProperties.toMutableMap() } @@ -873,6 +898,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -927,6 +970,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -955,6 +999,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -989,7 +1034,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1656,15 +1702,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanGroupedTieredPackagePrice && cadence == other.cadence && groupedTieredPackageConfig == other.groupedTieredPackageConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanGroupedTieredPackagePrice && cadence == other.cadence && groupedTieredPackageConfig == other.groupedTieredPackageConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, groupedTieredPackageConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedTieredPackageConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanGroupedTieredPackagePrice{cadence=$cadence, groupedTieredPackageConfig=$groupedTieredPackageConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanGroupedTieredPackagePrice{cadence=$cadence, groupedTieredPackageConfig=$groupedTieredPackageConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedTieredPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedTieredPrice.kt index a5230054..dd6be9a3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedTieredPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedTieredPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, groupedTieredConfig, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -412,6 +426,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -464,6 +487,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -485,6 +509,7 @@ private constructor( invoiceGroupingKey = newPlanGroupedTieredPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanGroupedTieredPrice.invoicingCycleConfiguration metadata = newPlanGroupedTieredPrice.metadata + referenceId = newPlanGroupedTieredPrice.referenceId additionalProperties = newPlanGroupedTieredPrice.additionalProperties.toMutableMap() } @@ -865,6 +890,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -919,6 +962,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -947,6 +991,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -981,7 +1026,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1643,15 +1689,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanGroupedTieredPrice && cadence == other.cadence && groupedTieredConfig == other.groupedTieredConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanGroupedTieredPrice && cadence == other.cadence && groupedTieredConfig == other.groupedTieredConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, groupedTieredConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedTieredConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanGroupedTieredPrice{cadence=$cadence, groupedTieredConfig=$groupedTieredConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanGroupedTieredPrice{cadence=$cadence, groupedTieredConfig=$groupedTieredConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedWithMeteredMinimumPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedWithMeteredMinimumPrice.kt index d4696731..14ee1598 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedWithMeteredMinimumPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedWithMeteredMinimumPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -96,6 +97,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, groupedWithMeteredMinimumConfig, @@ -114,6 +118,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -261,6 +266,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -414,6 +428,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -468,6 +491,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -495,6 +519,7 @@ private constructor( invoicingCycleConfiguration = newPlanGroupedWithMeteredMinimumPrice.invoicingCycleConfiguration metadata = newPlanGroupedWithMeteredMinimumPrice.metadata + referenceId = newPlanGroupedWithMeteredMinimumPrice.referenceId additionalProperties = newPlanGroupedWithMeteredMinimumPrice.additionalProperties.toMutableMap() } @@ -877,6 +902,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -931,6 +974,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -959,6 +1003,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -993,7 +1038,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1661,15 +1707,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanGroupedWithMeteredMinimumPrice && cadence == other.cadence && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanGroupedWithMeteredMinimumPrice && cadence == other.cadence && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, groupedWithMeteredMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedWithMeteredMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanGroupedWithMeteredMinimumPrice{cadence=$cadence, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanGroupedWithMeteredMinimumPrice{cadence=$cadence, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedWithProratedMinimumPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedWithProratedMinimumPrice.kt index 7f316185..26ed4ad4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedWithProratedMinimumPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanGroupedWithProratedMinimumPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -96,6 +97,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, groupedWithProratedMinimumConfig, @@ -114,6 +118,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -261,6 +266,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -414,6 +428,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -468,6 +491,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -495,6 +519,7 @@ private constructor( invoicingCycleConfiguration = newPlanGroupedWithProratedMinimumPrice.invoicingCycleConfiguration metadata = newPlanGroupedWithProratedMinimumPrice.metadata + referenceId = newPlanGroupedWithProratedMinimumPrice.referenceId additionalProperties = newPlanGroupedWithProratedMinimumPrice.additionalProperties.toMutableMap() } @@ -877,6 +902,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -931,6 +974,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -959,6 +1003,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -993,7 +1038,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1661,15 +1707,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanGroupedWithProratedMinimumPrice && cadence == other.cadence && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanGroupedWithProratedMinimumPrice && cadence == other.cadence && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, groupedWithProratedMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, groupedWithProratedMinimumConfig, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanGroupedWithProratedMinimumPrice{cadence=$cadence, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanGroupedWithProratedMinimumPrice{cadence=$cadence, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMatrixPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMatrixPrice.kt index da3c996c..3bec98dd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMatrixPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMatrixPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -259,6 +264,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -410,6 +424,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -462,6 +485,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -483,6 +507,7 @@ private constructor( invoiceGroupingKey = newPlanMatrixPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanMatrixPrice.invoicingCycleConfiguration metadata = newPlanMatrixPrice.metadata + referenceId = newPlanMatrixPrice.referenceId additionalProperties = newPlanMatrixPrice.additionalProperties.toMutableMap() } @@ -862,6 +887,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -916,6 +959,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -944,6 +988,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -978,7 +1023,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1538,15 +1584,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanMatrixPrice && cadence == other.cadence && itemId == other.itemId && matrixConfig == other.matrixConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanMatrixPrice && cadence == other.cadence && itemId == other.itemId && matrixConfig == other.matrixConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, matrixConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, matrixConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanMatrixPrice{cadence=$cadence, itemId=$itemId, matrixConfig=$matrixConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanMatrixPrice{cadence=$cadence, itemId=$itemId, matrixConfig=$matrixConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMatrixWithAllocationPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMatrixWithAllocationPrice.kt index 26363011..b5e8e778 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMatrixWithAllocationPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMatrixWithAllocationPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -413,6 +427,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -466,6 +489,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -492,6 +516,7 @@ private constructor( invoicingCycleConfiguration = newPlanMatrixWithAllocationPrice.invoicingCycleConfiguration metadata = newPlanMatrixWithAllocationPrice.metadata + referenceId = newPlanMatrixWithAllocationPrice.referenceId additionalProperties = newPlanMatrixWithAllocationPrice.additionalProperties.toMutableMap() } @@ -873,6 +898,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -927,6 +970,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -955,6 +999,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -989,7 +1034,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1549,15 +1595,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanMatrixWithAllocationPrice && cadence == other.cadence && itemId == other.itemId && matrixWithAllocationConfig == other.matrixWithAllocationConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanMatrixWithAllocationPrice && cadence == other.cadence && itemId == other.itemId && matrixWithAllocationConfig == other.matrixWithAllocationConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, matrixWithAllocationConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, matrixWithAllocationConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanMatrixWithAllocationPrice{cadence=$cadence, itemId=$itemId, matrixWithAllocationConfig=$matrixWithAllocationConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanMatrixWithAllocationPrice{cadence=$cadence, itemId=$itemId, matrixWithAllocationConfig=$matrixWithAllocationConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMatrixWithDisplayNamePrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMatrixWithDisplayNamePrice.kt index 322a66ba..4021d488 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMatrixWithDisplayNamePrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMatrixWithDisplayNamePrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -413,6 +427,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -466,6 +489,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -492,6 +516,7 @@ private constructor( invoicingCycleConfiguration = newPlanMatrixWithDisplayNamePrice.invoicingCycleConfiguration metadata = newPlanMatrixWithDisplayNamePrice.metadata + referenceId = newPlanMatrixWithDisplayNamePrice.referenceId additionalProperties = newPlanMatrixWithDisplayNamePrice.additionalProperties.toMutableMap() } @@ -873,6 +898,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -927,6 +970,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -955,6 +999,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -989,7 +1034,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1656,15 +1702,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanMatrixWithDisplayNamePrice && cadence == other.cadence && itemId == other.itemId && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanMatrixWithDisplayNamePrice && cadence == other.cadence && itemId == other.itemId && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, matrixWithDisplayNameConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, matrixWithDisplayNameConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanMatrixWithDisplayNamePrice{cadence=$cadence, itemId=$itemId, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanMatrixWithDisplayNamePrice{cadence=$cadence, itemId=$itemId, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMaxGroupTieredPackagePrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMaxGroupTieredPackagePrice.kt index 43e8d5a9..4729bd17 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMaxGroupTieredPackagePrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanMaxGroupTieredPackagePrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -413,6 +427,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -466,6 +489,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -492,6 +516,7 @@ private constructor( invoicingCycleConfiguration = newPlanMaxGroupTieredPackagePrice.invoicingCycleConfiguration metadata = newPlanMaxGroupTieredPackagePrice.metadata + referenceId = newPlanMaxGroupTieredPackagePrice.referenceId additionalProperties = newPlanMaxGroupTieredPackagePrice.additionalProperties.toMutableMap() } @@ -873,6 +898,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -927,6 +970,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -955,6 +999,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -989,7 +1034,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1656,15 +1702,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanMaxGroupTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanMaxGroupTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, maxGroupTieredPackageConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, maxGroupTieredPackageConfig, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanMaxGroupTieredPackagePrice{cadence=$cadence, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanMaxGroupTieredPackagePrice{cadence=$cadence, itemId=$itemId, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanPackagePrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanPackagePrice.kt index f2c781b1..6abe5251 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanPackagePrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanPackagePrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -259,6 +264,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -410,6 +424,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -462,6 +485,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -483,6 +507,7 @@ private constructor( invoiceGroupingKey = newPlanPackagePrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanPackagePrice.invoicingCycleConfiguration metadata = newPlanPackagePrice.metadata + referenceId = newPlanPackagePrice.referenceId additionalProperties = newPlanPackagePrice.additionalProperties.toMutableMap() } @@ -862,6 +887,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -916,6 +959,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -944,6 +988,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -978,7 +1023,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1538,15 +1584,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageConfig=$packageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageConfig=$packageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanPackageWithAllocationPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanPackageWithAllocationPrice.kt index 17a344c6..de1b4adb 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanPackageWithAllocationPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanPackageWithAllocationPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -413,6 +427,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -466,6 +489,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -492,6 +516,7 @@ private constructor( invoicingCycleConfiguration = newPlanPackageWithAllocationPrice.invoicingCycleConfiguration metadata = newPlanPackageWithAllocationPrice.metadata + referenceId = newPlanPackageWithAllocationPrice.referenceId additionalProperties = newPlanPackageWithAllocationPrice.additionalProperties.toMutableMap() } @@ -873,6 +898,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -927,6 +970,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -955,6 +999,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -989,7 +1034,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1656,15 +1702,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanPackageWithAllocationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanPackageWithAllocationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageWithAllocationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, packageWithAllocationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanPackageWithAllocationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanPackageWithAllocationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithTieredPricingPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithTieredPricingPrice.kt index 22bb6057..56dba4c1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithTieredPricingPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithTieredPricingPrice.kt @@ -49,6 +49,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -97,6 +98,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -115,6 +119,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -264,6 +269,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -417,6 +431,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -472,6 +495,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -499,6 +523,7 @@ private constructor( invoicingCycleConfiguration = newPlanScalableMatrixWithTieredPricingPrice.invoicingCycleConfiguration metadata = newPlanScalableMatrixWithTieredPricingPrice.metadata + referenceId = newPlanScalableMatrixWithTieredPricingPrice.referenceId additionalProperties = newPlanScalableMatrixWithTieredPricingPrice.additionalProperties.toMutableMap() } @@ -886,6 +911,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -943,6 +986,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -971,6 +1015,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -1005,7 +1050,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1675,15 +1721,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanScalableMatrixWithTieredPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanScalableMatrixWithTieredPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, scalableMatrixWithTieredPricingConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, scalableMatrixWithTieredPricingConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanScalableMatrixWithTieredPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanScalableMatrixWithTieredPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithUnitPricingPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithUnitPricingPrice.kt index ab275666..ea62e58f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithUnitPricingPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithUnitPricingPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -96,6 +97,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -114,6 +118,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -261,6 +266,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -414,6 +428,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -469,6 +492,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -496,6 +520,7 @@ private constructor( invoicingCycleConfiguration = newPlanScalableMatrixWithUnitPricingPrice.invoicingCycleConfiguration metadata = newPlanScalableMatrixWithUnitPricingPrice.metadata + referenceId = newPlanScalableMatrixWithUnitPricingPrice.referenceId additionalProperties = newPlanScalableMatrixWithUnitPricingPrice.additionalProperties.toMutableMap() } @@ -878,6 +903,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -935,6 +978,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -963,6 +1007,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -997,7 +1042,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1667,15 +1713,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanScalableMatrixWithUnitPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanScalableMatrixWithUnitPricingPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, scalableMatrixWithUnitPricingConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, scalableMatrixWithUnitPricingConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanScalableMatrixWithUnitPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanScalableMatrixWithUnitPricingPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanThresholdTotalAmountPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanThresholdTotalAmountPrice.kt index a5bed4b6..cb2ab412 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanThresholdTotalAmountPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanThresholdTotalAmountPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -413,6 +427,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -466,6 +489,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -492,6 +516,7 @@ private constructor( invoicingCycleConfiguration = newPlanThresholdTotalAmountPrice.invoicingCycleConfiguration metadata = newPlanThresholdTotalAmountPrice.metadata + referenceId = newPlanThresholdTotalAmountPrice.referenceId additionalProperties = newPlanThresholdTotalAmountPrice.additionalProperties.toMutableMap() } @@ -873,6 +898,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -927,6 +970,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -955,6 +999,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -989,7 +1034,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1656,15 +1702,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanThresholdTotalAmountPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanThresholdTotalAmountPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, thresholdTotalAmountConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, thresholdTotalAmountConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanThresholdTotalAmountPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanThresholdTotalAmountPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTierWithProrationPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTierWithProrationPrice.kt index 8cee48cb..42126010 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTierWithProrationPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTierWithProrationPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -413,6 +427,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -466,6 +489,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -488,6 +512,7 @@ private constructor( invoiceGroupingKey = newPlanTierWithProrationPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanTierWithProrationPrice.invoicingCycleConfiguration metadata = newPlanTierWithProrationPrice.metadata + referenceId = newPlanTierWithProrationPrice.referenceId additionalProperties = newPlanTierWithProrationPrice.additionalProperties.toMutableMap() } @@ -868,6 +893,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -922,6 +965,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -950,6 +994,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -984,7 +1029,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1650,15 +1696,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanTierWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithProrationConfig == other.tieredWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanTierWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithProrationConfig == other.tieredWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanTierWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithProrationConfig=$tieredWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanTierWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithProrationConfig=$tieredWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredBpsPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredBpsPrice.kt index 5af077ad..81b09aea 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredBpsPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredBpsPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -259,6 +264,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -410,6 +424,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -462,6 +485,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -483,6 +507,7 @@ private constructor( invoiceGroupingKey = newPlanTieredBpsPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanTieredBpsPrice.invoicingCycleConfiguration metadata = newPlanTieredBpsPrice.metadata + referenceId = newPlanTieredBpsPrice.referenceId additionalProperties = newPlanTieredBpsPrice.additionalProperties.toMutableMap() } @@ -863,6 +888,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -917,6 +960,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -945,6 +989,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -979,7 +1024,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1539,15 +1585,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanTieredBpsPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredBpsConfig == other.tieredBpsConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanTieredBpsPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredBpsConfig == other.tieredBpsConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredBpsConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredBpsConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanTieredBpsPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredBpsConfig=$tieredBpsConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanTieredBpsPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredBpsConfig=$tieredBpsConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredPackagePrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredPackagePrice.kt index 359a5d8a..9f38dceb 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredPackagePrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredPackagePrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -412,6 +426,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -464,6 +487,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -485,6 +509,7 @@ private constructor( invoiceGroupingKey = newPlanTieredPackagePrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanTieredPackagePrice.invoicingCycleConfiguration metadata = newPlanTieredPackagePrice.metadata + referenceId = newPlanTieredPackagePrice.referenceId additionalProperties = newPlanTieredPackagePrice.additionalProperties.toMutableMap() } @@ -865,6 +890,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -919,6 +962,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -947,6 +991,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -981,7 +1026,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1643,15 +1689,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageConfig == other.tieredPackageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanTieredPackagePrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageConfig == other.tieredPackageConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredPackageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredPackageConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanTieredPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageConfig=$tieredPackageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanTieredPackagePrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageConfig=$tieredPackageConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredPackageWithMinimumPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredPackageWithMinimumPrice.kt index fe595583..2b7362cc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredPackageWithMinimumPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredPackageWithMinimumPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -96,6 +97,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -114,6 +118,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -261,6 +266,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -414,6 +428,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -468,6 +491,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -495,6 +519,7 @@ private constructor( invoicingCycleConfiguration = newPlanTieredPackageWithMinimumPrice.invoicingCycleConfiguration metadata = newPlanTieredPackageWithMinimumPrice.metadata + referenceId = newPlanTieredPackageWithMinimumPrice.referenceId additionalProperties = newPlanTieredPackageWithMinimumPrice.additionalProperties.toMutableMap() } @@ -877,6 +902,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -931,6 +974,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -959,6 +1003,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -993,7 +1038,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1661,15 +1707,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanTieredPackageWithMinimumPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanTieredPackageWithMinimumPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredPackageWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredPackageWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanTieredPackageWithMinimumPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanTieredPackageWithMinimumPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredPrice.kt index b6e40789..34a8f718 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -259,6 +264,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -410,6 +424,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -462,6 +485,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -483,6 +507,7 @@ private constructor( invoiceGroupingKey = newPlanTieredPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanTieredPrice.invoicingCycleConfiguration metadata = newPlanTieredPrice.metadata + referenceId = newPlanTieredPrice.referenceId additionalProperties = newPlanTieredPrice.additionalProperties.toMutableMap() } @@ -862,6 +887,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -916,6 +959,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -944,6 +988,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -978,7 +1023,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1538,15 +1584,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanTieredPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredConfig == other.tieredConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanTieredPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredConfig == other.tieredConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanTieredPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredConfig=$tieredConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanTieredPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredConfig=$tieredConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredWithMinimumPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredWithMinimumPrice.kt index 71e5a2f8..099cc9ec 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredWithMinimumPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanTieredWithMinimumPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -412,6 +426,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -465,6 +488,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -487,6 +511,7 @@ private constructor( invoiceGroupingKey = newPlanTieredWithMinimumPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanTieredWithMinimumPrice.invoicingCycleConfiguration metadata = newPlanTieredWithMinimumPrice.metadata + referenceId = newPlanTieredWithMinimumPrice.referenceId additionalProperties = newPlanTieredWithMinimumPrice.additionalProperties.toMutableMap() } @@ -868,6 +893,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -922,6 +965,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -950,6 +994,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -984,7 +1029,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1649,15 +1695,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanTieredWithMinimumPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithMinimumConfig == other.tieredWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanTieredWithMinimumPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && tieredWithMinimumConfig == other.tieredWithMinimumConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, tieredWithMinimumConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanTieredWithMinimumPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithMinimumConfig=$tieredWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanTieredWithMinimumPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, tieredWithMinimumConfig=$tieredWithMinimumConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanUnitPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanUnitPrice.kt index 67c18a19..30519372 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanUnitPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanUnitPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -259,6 +264,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -410,6 +424,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -462,6 +485,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -483,6 +507,7 @@ private constructor( invoiceGroupingKey = newPlanUnitPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanUnitPrice.invoicingCycleConfiguration metadata = newPlanUnitPrice.metadata + referenceId = newPlanUnitPrice.referenceId additionalProperties = newPlanUnitPrice.additionalProperties.toMutableMap() } @@ -860,6 +885,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -914,6 +957,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -942,6 +986,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -976,7 +1021,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1536,15 +1582,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanUnitPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitConfig == other.unitConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanUnitPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitConfig == other.unitConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanUnitPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitConfig=$unitConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanUnitPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitConfig=$unitConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanUnitWithPercentPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanUnitWithPercentPrice.kt index c25ee307..3aa71c94 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanUnitWithPercentPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanUnitWithPercentPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -412,6 +426,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -464,6 +487,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -486,6 +510,7 @@ private constructor( invoiceGroupingKey = newPlanUnitWithPercentPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanUnitWithPercentPrice.invoicingCycleConfiguration metadata = newPlanUnitWithPercentPrice.metadata + referenceId = newPlanUnitWithPercentPrice.referenceId additionalProperties = newPlanUnitWithPercentPrice.additionalProperties.toMutableMap() } @@ -866,6 +891,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -920,6 +963,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -948,6 +992,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -982,7 +1027,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1647,15 +1693,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanUnitWithPercentPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithPercentConfig == other.unitWithPercentConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanUnitWithPercentPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithPercentConfig == other.unitWithPercentConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithPercentConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithPercentConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanUnitWithPercentPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithPercentConfig=$unitWithPercentConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanUnitWithPercentPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithPercentConfig=$unitWithPercentConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanUnitWithProrationPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanUnitWithProrationPrice.kt index dbf77d0a..effeab8c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanUnitWithProrationPrice.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanUnitWithProrationPrice.kt @@ -48,6 +48,7 @@ private constructor( private val invoiceGroupingKey: JsonField, private val invoicingCycleConfiguration: JsonField, private val metadata: JsonField, + private val referenceId: JsonField, private val additionalProperties: MutableMap, ) { @@ -95,6 +96,9 @@ private constructor( @ExcludeMissing invoicingCycleConfiguration: JsonField = JsonMissing.of(), @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), + @JsonProperty("reference_id") + @ExcludeMissing + referenceId: JsonField = JsonMissing.of(), ) : this( cadence, itemId, @@ -113,6 +117,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, mutableMapOf(), ) @@ -260,6 +265,15 @@ private constructor( */ fun metadata(): Optional = metadata.getOptional("metadata") + /** + * A transient ID that can be used to reference this price when adding adjustments in the same + * API call. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun referenceId(): Optional = referenceId.getOptional("reference_id") + /** * Returns the raw JSON value of [cadence]. * @@ -412,6 +426,15 @@ private constructor( */ @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** + * Returns the raw JSON value of [referenceId]. + * + * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reference_id") + @ExcludeMissing + fun _referenceId(): JsonField = referenceId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -465,6 +488,7 @@ private constructor( private var invoicingCycleConfiguration: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() + private var referenceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -487,6 +511,7 @@ private constructor( invoiceGroupingKey = newPlanUnitWithProrationPrice.invoiceGroupingKey invoicingCycleConfiguration = newPlanUnitWithProrationPrice.invoicingCycleConfiguration metadata = newPlanUnitWithProrationPrice.metadata + referenceId = newPlanUnitWithProrationPrice.referenceId additionalProperties = newPlanUnitWithProrationPrice.additionalProperties.toMutableMap() } @@ -868,6 +893,24 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + /** + * A transient ID that can be used to reference this price when adding adjustments in the + * same API call. + */ + fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId)) + + /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */ + fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull()) + + /** + * Sets [Builder.referenceId] to an arbitrary JSON value. + * + * You should usually call [Builder.referenceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -922,6 +965,7 @@ private constructor( invoiceGroupingKey, invoicingCycleConfiguration, metadata, + referenceId, additionalProperties.toMutableMap(), ) } @@ -950,6 +994,7 @@ private constructor( invoiceGroupingKey() invoicingCycleConfiguration().ifPresent { it.validate() } metadata().ifPresent { it.validate() } + referenceId() validated = true } @@ -984,7 +1029,8 @@ private constructor( (if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) + (if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) + (invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (referenceId.asKnown().isPresent) 1 else 0) /** The cadence to bill for this price on. */ class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1649,15 +1695,15 @@ private constructor( return true } - return /* spotless:off */ other is NewPlanUnitWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithProrationConfig == other.unitWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is NewPlanUnitWithProrationPrice && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && unitWithProrationConfig == other.unitWithProrationConfig && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(cadence, itemId, modelType, name, unitWithProrationConfig, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "NewPlanUnitWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithProrationConfig=$unitWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}" + "NewPlanUnitWithProrationPrice{cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, unitWithProrationConfig=$unitWithProrationConfig, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt index d9f39e5f..2fc09d4c 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 @@ -64,6 +64,15 @@ private constructor( */ fun prices(): List = body.prices() + /** + * Adjustments for this plan. If the plan has phases, this includes adjustments across all + * phases of the plan. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun adjustments(): Optional> = body.adjustments() + /** * Free-form text which is available on the invoice PDF and the Orb invoice portal. * @@ -97,6 +106,15 @@ private constructor( */ fun netTerms(): Optional = body.netTerms() + /** + * Configuration of pre-defined phases, each with their own prices and adjustments. Leave + * unspecified for plans with a single phase. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun planPhases(): Optional> = body.planPhases() + /** * The status of the plan to create (either active or draft). If not specified, this defaults to * active. @@ -127,6 +145,13 @@ private constructor( */ fun _prices(): JsonField> = body._prices() + /** + * Returns the raw JSON value of [adjustments]. + * + * Unlike [adjustments], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _adjustments(): JsonField> = body._adjustments() + /** * Returns the raw JSON value of [defaultInvoiceMemo]. * @@ -156,6 +181,13 @@ private constructor( */ fun _netTerms(): JsonField = body._netTerms() + /** + * Returns the raw JSON value of [planPhases]. + * + * Unlike [planPhases], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _planPhases(): JsonField> = body._planPhases() + /** * Returns the raw JSON value of [status]. * @@ -208,8 +240,8 @@ private constructor( * - [currency] * - [name] * - [prices] + * - [adjustments] * - [defaultInvoiceMemo] - * - [externalPlanId] * - etc. */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -257,160 +289,33 @@ private constructor( */ fun addPrice(price: Price) = apply { body.addPrice(price) } - /** Alias for calling [addPrice] with `Price.ofUnit(unit)`. */ - fun addPrice(unit: NewPlanUnitPrice) = apply { body.addPrice(unit) } - - /** Alias for calling [addPrice] with `Price.ofPackage(package_)`. */ - fun addPrice(package_: NewPlanPackagePrice) = apply { body.addPrice(package_) } - - /** Alias for calling [addPrice] with `Price.ofMatrix(matrix)`. */ - fun addPrice(matrix: NewPlanMatrixPrice) = apply { body.addPrice(matrix) } - - /** Alias for calling [addPrice] with `Price.ofTiered(tiered)`. */ - fun addPrice(tiered: NewPlanTieredPrice) = apply { body.addPrice(tiered) } - - /** Alias for calling [addPrice] with `Price.ofTieredBps(tieredBps)`. */ - fun addPrice(tieredBps: NewPlanTieredBpsPrice) = apply { body.addPrice(tieredBps) } - - /** Alias for calling [addPrice] with `Price.ofBps(bps)`. */ - fun addPrice(bps: NewPlanBpsPrice) = apply { body.addPrice(bps) } - - /** Alias for calling [addPrice] with `Price.ofBulkBps(bulkBps)`. */ - fun addPrice(bulkBps: NewPlanBulkBpsPrice) = apply { body.addPrice(bulkBps) } - - /** Alias for calling [addPrice] with `Price.ofBulk(bulk)`. */ - fun addPrice(bulk: NewPlanBulkPrice) = apply { body.addPrice(bulk) } - - /** - * Alias for calling [addPrice] with `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. - */ - fun addPrice(thresholdTotalAmount: NewPlanThresholdTotalAmountPrice) = apply { - body.addPrice(thresholdTotalAmount) - } - - /** Alias for calling [addPrice] with `Price.ofTieredPackage(tieredPackage)`. */ - fun addPrice(tieredPackage: NewPlanTieredPackagePrice) = apply { - body.addPrice(tieredPackage) - } - - /** Alias for calling [addPrice] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun addPrice(tieredWithMinimum: NewPlanTieredWithMinimumPrice) = apply { - body.addPrice(tieredWithMinimum) - } - - /** Alias for calling [addPrice] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun addPrice(unitWithPercent: NewPlanUnitWithPercentPrice) = apply { - body.addPrice(unitWithPercent) - } - - /** - * Alias for calling [addPrice] with `Price.ofPackageWithAllocation(packageWithAllocation)`. - */ - fun addPrice(packageWithAllocation: NewPlanPackageWithAllocationPrice) = apply { - body.addPrice(packageWithAllocation) - } - - /** Alias for calling [addPrice] with `Price.ofTieredWithProration(tieredWithProration)`. */ - fun addPrice(tieredWithProration: NewPlanTierWithProrationPrice) = apply { - body.addPrice(tieredWithProration) - } - - /** Alias for calling [addPrice] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun addPrice(unitWithProration: NewPlanUnitWithProrationPrice) = apply { - body.addPrice(unitWithProration) - } - - /** Alias for calling [addPrice] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun addPrice(groupedAllocation: NewPlanGroupedAllocationPrice) = apply { - body.addPrice(groupedAllocation) - } - - /** - * Alias for calling [addPrice] with - * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. - */ - fun addPrice(groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice) = apply { - body.addPrice(groupedWithProratedMinimum) - } - - /** - * Alias for calling [addPrice] with - * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. - */ - fun addPrice(groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice) = apply { - body.addPrice(groupedWithMeteredMinimum) - } - - /** - * Alias for calling [addPrice] with `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. - */ - fun addPrice(matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice) = apply { - body.addPrice(matrixWithDisplayName) - } - - /** Alias for calling [addPrice] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun addPrice(bulkWithProration: NewPlanBulkWithProrationPrice) = apply { - body.addPrice(bulkWithProration) - } - - /** - * Alias for calling [addPrice] with `Price.ofGroupedTieredPackage(groupedTieredPackage)`. - */ - fun addPrice(groupedTieredPackage: NewPlanGroupedTieredPackagePrice) = apply { - body.addPrice(groupedTieredPackage) - } - - /** - * Alias for calling [addPrice] with `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. - */ - fun addPrice(maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice) = apply { - body.addPrice(maxGroupTieredPackage) - } - - /** - * Alias for calling [addPrice] with - * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. - */ - fun addPrice(scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice) = - apply { - body.addPrice(scalableMatrixWithUnitPricing) - } - /** - * Alias for calling [addPrice] with - * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. + * Adjustments for this plan. If the plan has phases, this includes adjustments across all + * phases of the plan. */ - fun addPrice(scalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice) = - apply { - body.addPrice(scalableMatrixWithTieredPricing) - } + fun adjustments(adjustments: List?) = apply { body.adjustments(adjustments) } - /** - * Alias for calling [addPrice] with `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. - */ - fun addPrice(cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice) = apply { - body.addPrice(cumulativeGroupedBulk) - } + /** Alias for calling [Builder.adjustments] with `adjustments.orElse(null)`. */ + fun adjustments(adjustments: Optional>) = + adjustments(adjustments.getOrNull()) /** - * Alias for calling [addPrice] with - * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. + * Sets [Builder.adjustments] to an arbitrary JSON value. + * + * You should usually call [Builder.adjustments] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun addPrice(tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice) = apply { - body.addPrice(tieredPackageWithMinimum) + fun adjustments(adjustments: JsonField>) = apply { + body.adjustments(adjustments) } /** - * Alias for calling [addPrice] with `Price.ofMatrixWithAllocation(matrixWithAllocation)`. + * Adds a single [Adjustment] to [adjustments]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addPrice(matrixWithAllocation: NewPlanMatrixWithAllocationPrice) = apply { - body.addPrice(matrixWithAllocation) - } - - /** Alias for calling [addPrice] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun addPrice(groupedTiered: NewPlanGroupedTieredPrice) = apply { - body.addPrice(groupedTiered) - } + fun addAdjustment(adjustment: Adjustment) = apply { body.addAdjustment(adjustment) } /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = apply { @@ -494,6 +399,33 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { body.netTerms(netTerms) } + /** + * Configuration of pre-defined phases, each with their own prices and adjustments. Leave + * unspecified for plans with a single phase. + */ + fun planPhases(planPhases: List?) = apply { body.planPhases(planPhases) } + + /** Alias for calling [Builder.planPhases] with `planPhases.orElse(null)`. */ + fun planPhases(planPhases: Optional>) = planPhases(planPhases.getOrNull()) + + /** + * Sets [Builder.planPhases] to an arbitrary JSON value. + * + * You should usually call [Builder.planPhases] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun planPhases(planPhases: JsonField>) = apply { + body.planPhases(planPhases) + } + + /** + * Adds a single [PlanPhase] to [planPhases]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addPlanPhase(planPhase: PlanPhase) = apply { body.addPlanPhase(planPhase) } + /** * The status of the plan to create (either active or draft). If not specified, this * defaults to active. @@ -654,10 +586,12 @@ private constructor( private val currency: JsonField, private val name: JsonField, private val prices: JsonField>, + private val adjustments: JsonField>, private val defaultInvoiceMemo: JsonField, private val externalPlanId: JsonField, private val metadata: JsonField, private val netTerms: JsonField, + private val planPhases: JsonField>, private val status: JsonField, private val additionalProperties: MutableMap, ) { @@ -671,6 +605,9 @@ private constructor( @JsonProperty("prices") @ExcludeMissing prices: JsonField> = JsonMissing.of(), + @JsonProperty("adjustments") + @ExcludeMissing + adjustments: JsonField> = JsonMissing.of(), @JsonProperty("default_invoice_memo") @ExcludeMissing defaultInvoiceMemo: JsonField = JsonMissing.of(), @@ -681,15 +618,20 @@ private constructor( @ExcludeMissing metadata: JsonField = JsonMissing.of(), @JsonProperty("net_terms") @ExcludeMissing netTerms: JsonField = JsonMissing.of(), + @JsonProperty("plan_phases") + @ExcludeMissing + planPhases: JsonField> = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), ) : this( currency, name, prices, + adjustments, defaultInvoiceMemo, externalPlanId, metadata, netTerms, + planPhases, status, mutableMapOf(), ) @@ -717,6 +659,15 @@ private constructor( */ fun prices(): List = prices.getRequired("prices") + /** + * Adjustments for this plan. If the plan has phases, this includes adjustments across all + * phases of the plan. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun adjustments(): Optional> = adjustments.getOptional("adjustments") + /** * Free-form text which is available on the invoice PDF and the Orb invoice portal. * @@ -751,6 +702,15 @@ private constructor( */ fun netTerms(): Optional = netTerms.getOptional("net_terms") + /** + * Configuration of pre-defined phases, each with their own prices and adjustments. Leave + * unspecified for plans with a single phase. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun planPhases(): Optional> = planPhases.getOptional("plan_phases") + /** * The status of the plan to create (either active or draft). If not specified, this * defaults to active. @@ -781,6 +741,15 @@ private constructor( */ @JsonProperty("prices") @ExcludeMissing fun _prices(): JsonField> = prices + /** + * Returns the raw JSON value of [adjustments]. + * + * Unlike [adjustments], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("adjustments") + @ExcludeMissing + fun _adjustments(): JsonField> = adjustments + /** * Returns the raw JSON value of [defaultInvoiceMemo]. * @@ -815,6 +784,15 @@ private constructor( */ @JsonProperty("net_terms") @ExcludeMissing fun _netTerms(): JsonField = netTerms + /** + * Returns the raw JSON value of [planPhases]. + * + * Unlike [planPhases], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("plan_phases") + @ExcludeMissing + fun _planPhases(): JsonField> = planPhases + /** * Returns the raw JSON value of [status]. * @@ -855,10 +833,12 @@ private constructor( private var currency: JsonField? = null private var name: JsonField? = null private var prices: JsonField>? = null + private var adjustments: JsonField>? = null private var defaultInvoiceMemo: JsonField = JsonMissing.of() private var externalPlanId: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() private var netTerms: JsonField = JsonMissing.of() + private var planPhases: JsonField>? = null private var status: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -867,10 +847,12 @@ private constructor( currency = body.currency name = body.name prices = body.prices.map { it.toMutableList() } + adjustments = body.adjustments.map { it.toMutableList() } defaultInvoiceMemo = body.defaultInvoiceMemo externalPlanId = body.externalPlanId metadata = body.metadata netTerms = body.netTerms + planPhases = body.planPhases.map { it.toMutableList() } status = body.status additionalProperties = body.additionalProperties.toMutableMap() } @@ -927,148 +909,39 @@ private constructor( } } - /** Alias for calling [addPrice] with `Price.ofUnit(unit)`. */ - fun addPrice(unit: NewPlanUnitPrice) = addPrice(Price.ofUnit(unit)) - - /** Alias for calling [addPrice] with `Price.ofPackage(package_)`. */ - fun addPrice(package_: NewPlanPackagePrice) = addPrice(Price.ofPackage(package_)) - - /** Alias for calling [addPrice] with `Price.ofMatrix(matrix)`. */ - fun addPrice(matrix: NewPlanMatrixPrice) = addPrice(Price.ofMatrix(matrix)) - - /** Alias for calling [addPrice] with `Price.ofTiered(tiered)`. */ - fun addPrice(tiered: NewPlanTieredPrice) = addPrice(Price.ofTiered(tiered)) - - /** Alias for calling [addPrice] with `Price.ofTieredBps(tieredBps)`. */ - fun addPrice(tieredBps: NewPlanTieredBpsPrice) = addPrice(Price.ofTieredBps(tieredBps)) - - /** Alias for calling [addPrice] with `Price.ofBps(bps)`. */ - fun addPrice(bps: NewPlanBpsPrice) = addPrice(Price.ofBps(bps)) - - /** Alias for calling [addPrice] with `Price.ofBulkBps(bulkBps)`. */ - fun addPrice(bulkBps: NewPlanBulkBpsPrice) = addPrice(Price.ofBulkBps(bulkBps)) - - /** Alias for calling [addPrice] with `Price.ofBulk(bulk)`. */ - fun addPrice(bulk: NewPlanBulkPrice) = addPrice(Price.ofBulk(bulk)) - - /** - * Alias for calling [addPrice] with - * `Price.ofThresholdTotalAmount(thresholdTotalAmount)`. - */ - fun addPrice(thresholdTotalAmount: NewPlanThresholdTotalAmountPrice) = - addPrice(Price.ofThresholdTotalAmount(thresholdTotalAmount)) - - /** Alias for calling [addPrice] with `Price.ofTieredPackage(tieredPackage)`. */ - fun addPrice(tieredPackage: NewPlanTieredPackagePrice) = - addPrice(Price.ofTieredPackage(tieredPackage)) - - /** Alias for calling [addPrice] with `Price.ofTieredWithMinimum(tieredWithMinimum)`. */ - fun addPrice(tieredWithMinimum: NewPlanTieredWithMinimumPrice) = - addPrice(Price.ofTieredWithMinimum(tieredWithMinimum)) - - /** Alias for calling [addPrice] with `Price.ofUnitWithPercent(unitWithPercent)`. */ - fun addPrice(unitWithPercent: NewPlanUnitWithPercentPrice) = - addPrice(Price.ofUnitWithPercent(unitWithPercent)) - - /** - * Alias for calling [addPrice] with - * `Price.ofPackageWithAllocation(packageWithAllocation)`. - */ - fun addPrice(packageWithAllocation: NewPlanPackageWithAllocationPrice) = - addPrice(Price.ofPackageWithAllocation(packageWithAllocation)) - - /** - * Alias for calling [addPrice] with `Price.ofTieredWithProration(tieredWithProration)`. - */ - fun addPrice(tieredWithProration: NewPlanTierWithProrationPrice) = - addPrice(Price.ofTieredWithProration(tieredWithProration)) - - /** Alias for calling [addPrice] with `Price.ofUnitWithProration(unitWithProration)`. */ - fun addPrice(unitWithProration: NewPlanUnitWithProrationPrice) = - addPrice(Price.ofUnitWithProration(unitWithProration)) - - /** Alias for calling [addPrice] with `Price.ofGroupedAllocation(groupedAllocation)`. */ - fun addPrice(groupedAllocation: NewPlanGroupedAllocationPrice) = - addPrice(Price.ofGroupedAllocation(groupedAllocation)) - - /** - * Alias for calling [addPrice] with - * `Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. - */ - fun addPrice(groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice) = - addPrice(Price.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) - - /** - * Alias for calling [addPrice] with - * `Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. - */ - fun addPrice(groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice) = - addPrice(Price.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) - - /** - * Alias for calling [addPrice] with - * `Price.ofMatrixWithDisplayName(matrixWithDisplayName)`. - */ - fun addPrice(matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice) = - addPrice(Price.ofMatrixWithDisplayName(matrixWithDisplayName)) - - /** Alias for calling [addPrice] with `Price.ofBulkWithProration(bulkWithProration)`. */ - fun addPrice(bulkWithProration: NewPlanBulkWithProrationPrice) = - addPrice(Price.ofBulkWithProration(bulkWithProration)) - /** - * Alias for calling [addPrice] with - * `Price.ofGroupedTieredPackage(groupedTieredPackage)`. + * Adjustments for this plan. If the plan has phases, this includes adjustments across + * all phases of the plan. */ - fun addPrice(groupedTieredPackage: NewPlanGroupedTieredPackagePrice) = - addPrice(Price.ofGroupedTieredPackage(groupedTieredPackage)) + fun adjustments(adjustments: List?) = + adjustments(JsonField.ofNullable(adjustments)) - /** - * Alias for calling [addPrice] with - * `Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. - */ - fun addPrice(maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice) = - addPrice(Price.ofMaxGroupTieredPackage(maxGroupTieredPackage)) - - /** - * Alias for calling [addPrice] with - * `Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. - */ - fun addPrice(scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice) = - addPrice(Price.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) - - /** - * Alias for calling [addPrice] with - * `Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. - */ - fun addPrice( - scalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice - ) = addPrice(Price.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) - - /** - * Alias for calling [addPrice] with - * `Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. - */ - fun addPrice(cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice) = - addPrice(Price.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) + /** Alias for calling [Builder.adjustments] with `adjustments.orElse(null)`. */ + fun adjustments(adjustments: Optional>) = + adjustments(adjustments.getOrNull()) /** - * Alias for calling [addPrice] with - * `Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. + * Sets [Builder.adjustments] to an arbitrary JSON value. + * + * You should usually call [Builder.adjustments] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun addPrice(tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice) = - addPrice(Price.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) + fun adjustments(adjustments: JsonField>) = apply { + this.adjustments = adjustments.map { it.toMutableList() } + } /** - * Alias for calling [addPrice] with - * `Price.ofMatrixWithAllocation(matrixWithAllocation)`. + * Adds a single [Adjustment] to [adjustments]. + * + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addPrice(matrixWithAllocation: NewPlanMatrixWithAllocationPrice) = - addPrice(Price.ofMatrixWithAllocation(matrixWithAllocation)) - - /** Alias for calling [addPrice] with `Price.ofGroupedTiered(groupedTiered)`. */ - fun addPrice(groupedTiered: NewPlanGroupedTieredPrice) = - addPrice(Price.ofGroupedTiered(groupedTiered)) + fun addAdjustment(adjustment: Adjustment) = apply { + adjustments = + (adjustments ?: JsonField.of(mutableListOf())).also { + checkKnown("adjustments", it).add(adjustment) + } + } /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ fun defaultInvoiceMemo(defaultInvoiceMemo: String?) = @@ -1154,6 +1027,40 @@ private constructor( */ fun netTerms(netTerms: JsonField) = apply { this.netTerms = netTerms } + /** + * Configuration of pre-defined phases, each with their own prices and adjustments. + * Leave unspecified for plans with a single phase. + */ + fun planPhases(planPhases: List?) = + planPhases(JsonField.ofNullable(planPhases)) + + /** Alias for calling [Builder.planPhases] with `planPhases.orElse(null)`. */ + fun planPhases(planPhases: Optional>) = + planPhases(planPhases.getOrNull()) + + /** + * Sets [Builder.planPhases] to an arbitrary JSON value. + * + * You should usually call [Builder.planPhases] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun planPhases(planPhases: JsonField>) = apply { + this.planPhases = planPhases.map { it.toMutableList() } + } + + /** + * Adds a single [PlanPhase] to [planPhases]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addPlanPhase(planPhase: PlanPhase) = apply { + planPhases = + (planPhases ?: JsonField.of(mutableListOf())).also { + checkKnown("planPhases", it).add(planPhase) + } + } + /** * The status of the plan to create (either active or draft). If not specified, this * defaults to active. @@ -1207,10 +1114,12 @@ private constructor( checkRequired("currency", currency), checkRequired("name", name), checkRequired("prices", prices).map { it.toImmutable() }, + (adjustments ?: JsonMissing.of()).map { it.toImmutable() }, defaultInvoiceMemo, externalPlanId, metadata, netTerms, + (planPhases ?: JsonMissing.of()).map { it.toImmutable() }, status, additionalProperties.toMutableMap(), ) @@ -1226,10 +1135,12 @@ private constructor( currency() name() prices().forEach { it.validate() } + adjustments().ifPresent { it.forEach { it.validate() } } defaultInvoiceMemo() externalPlanId() metadata().ifPresent { it.validate() } netTerms() + planPhases().ifPresent { it.forEach { it.validate() } } status().ifPresent { it.validate() } validated = true } @@ -1253,10 +1164,12 @@ private constructor( (if (currency.asKnown().isPresent) 1 else 0) + (if (name.asKnown().isPresent) 1 else 0) + (prices.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (adjustments.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (defaultInvoiceMemo.asKnown().isPresent) 1 else 0) + (if (externalPlanId.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (netTerms.asKnown().isPresent) 1 else 0) + + (planPhases.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (status.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { @@ -1264,1140 +1177,2166 @@ private constructor( return true } - 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 */ + return /* spotless:off */ other is Body && currency == other.currency && name == other.name && prices == other.prices && adjustments == other.adjustments && defaultInvoiceMemo == other.defaultInvoiceMemo && externalPlanId == other.externalPlanId && metadata == other.metadata && netTerms == other.netTerms && planPhases == other.planPhases && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, name, prices, defaultInvoiceMemo, externalPlanId, metadata, netTerms, status, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(currency, name, prices, adjustments, defaultInvoiceMemo, externalPlanId, metadata, netTerms, planPhases, status, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Body{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, adjustments=$adjustments, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, metadata=$metadata, netTerms=$netTerms, planPhases=$planPhases, status=$status, additionalProperties=$additionalProperties}" } - @JsonDeserialize(using = Price.Deserializer::class) - @JsonSerialize(using = Price.Serializer::class) class Price private constructor( - private val unit: NewPlanUnitPrice? = null, - private val package_: NewPlanPackagePrice? = null, - private val matrix: NewPlanMatrixPrice? = null, - private val tiered: NewPlanTieredPrice? = null, - private val tieredBps: NewPlanTieredBpsPrice? = null, - private val bps: NewPlanBpsPrice? = null, - private val bulkBps: NewPlanBulkBpsPrice? = null, - private val bulk: NewPlanBulkPrice? = null, - private val thresholdTotalAmount: NewPlanThresholdTotalAmountPrice? = null, - private val tieredPackage: NewPlanTieredPackagePrice? = null, - private val tieredWithMinimum: NewPlanTieredWithMinimumPrice? = null, - private val unitWithPercent: NewPlanUnitWithPercentPrice? = null, - private val packageWithAllocation: NewPlanPackageWithAllocationPrice? = null, - private val tieredWithProration: NewPlanTierWithProrationPrice? = null, - private val unitWithProration: NewPlanUnitWithProrationPrice? = null, - private val groupedAllocation: NewPlanGroupedAllocationPrice? = null, - private val groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice? = null, - private val groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice? = null, - private val matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice? = null, - private val bulkWithProration: NewPlanBulkWithProrationPrice? = null, - private val groupedTieredPackage: NewPlanGroupedTieredPackagePrice? = null, - private val maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice? = null, - private val scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice? = - null, - private val scalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice? = - null, - private val cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice? = null, - private val tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice? = null, - private val matrixWithAllocation: NewPlanMatrixWithAllocationPrice? = null, - private val groupedTiered: NewPlanGroupedTieredPrice? = null, - private val _json: JsonValue? = null, + private val allocationPrice: JsonField, + private val planPhaseOrder: JsonField, + private val price: JsonField, + private val additionalProperties: MutableMap, ) { - fun unit(): Optional = Optional.ofNullable(unit) - - fun package_(): Optional = Optional.ofNullable(package_) - - fun matrix(): Optional = Optional.ofNullable(matrix) - - fun tiered(): Optional = Optional.ofNullable(tiered) - - fun tieredBps(): Optional = Optional.ofNullable(tieredBps) + @JsonCreator + private constructor( + @JsonProperty("allocation_price") + @ExcludeMissing + allocationPrice: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + planPhaseOrder: JsonField = JsonMissing.of(), + @JsonProperty("price") @ExcludeMissing price: JsonField = JsonMissing.of(), + ) : this(allocationPrice, planPhaseOrder, price, mutableMapOf()) - fun bps(): Optional = Optional.ofNullable(bps) + /** + * The allocation price to add to the plan. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun allocationPrice(): Optional = + allocationPrice.getOptional("allocation_price") - fun bulkBps(): Optional = Optional.ofNullable(bulkBps) + /** + * The phase to add this price to. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun planPhaseOrder(): Optional = planPhaseOrder.getOptional("plan_phase_order") - fun bulk(): Optional = Optional.ofNullable(bulk) + /** + * The price to add to the plan + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun price(): Optional = price.getOptional("price") - fun thresholdTotalAmount(): Optional = - Optional.ofNullable(thresholdTotalAmount) + /** + * Returns the raw JSON value of [allocationPrice]. + * + * Unlike [allocationPrice], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("allocation_price") + @ExcludeMissing + fun _allocationPrice(): JsonField = allocationPrice - fun tieredPackage(): Optional = - Optional.ofNullable(tieredPackage) + /** + * Returns the raw JSON value of [planPhaseOrder]. + * + * Unlike [planPhaseOrder], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder(): JsonField = planPhaseOrder - fun tieredWithMinimum(): Optional = - Optional.ofNullable(tieredWithMinimum) + /** + * Returns the raw JSON value of [price]. + * + * Unlike [price], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("price") @ExcludeMissing fun _price(): JsonField = price - fun unitWithPercent(): Optional = - Optional.ofNullable(unitWithPercent) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - fun packageWithAllocation(): Optional = - Optional.ofNullable(packageWithAllocation) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - fun tieredWithProration(): Optional = - Optional.ofNullable(tieredWithProration) + fun toBuilder() = Builder().from(this) - fun unitWithProration(): Optional = - Optional.ofNullable(unitWithProration) + companion object { - fun groupedAllocation(): Optional = - Optional.ofNullable(groupedAllocation) + /** Returns a mutable builder for constructing an instance of [Price]. */ + @JvmStatic fun builder() = Builder() + } - fun groupedWithProratedMinimum(): Optional = - Optional.ofNullable(groupedWithProratedMinimum) + /** A builder for [Price]. */ + class Builder internal constructor() { - fun groupedWithMeteredMinimum(): Optional = - Optional.ofNullable(groupedWithMeteredMinimum) + private var allocationPrice: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var price: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - fun matrixWithDisplayName(): Optional = - Optional.ofNullable(matrixWithDisplayName) + @JvmSynthetic + internal fun from(price: Price) = apply { + allocationPrice = price.allocationPrice + planPhaseOrder = price.planPhaseOrder + this.price = price.price + additionalProperties = price.additionalProperties.toMutableMap() + } - fun bulkWithProration(): Optional = - Optional.ofNullable(bulkWithProration) + /** The allocation price to add to the plan. */ + fun allocationPrice(allocationPrice: NewAllocationPrice?) = + allocationPrice(JsonField.ofNullable(allocationPrice)) - fun groupedTieredPackage(): Optional = - Optional.ofNullable(groupedTieredPackage) + /** Alias for calling [Builder.allocationPrice] with `allocationPrice.orElse(null)`. */ + fun allocationPrice(allocationPrice: Optional) = + allocationPrice(allocationPrice.getOrNull()) - fun maxGroupTieredPackage(): Optional = - Optional.ofNullable(maxGroupTieredPackage) + /** + * Sets [Builder.allocationPrice] to an arbitrary JSON value. + * + * You should usually call [Builder.allocationPrice] with a well-typed + * [NewAllocationPrice] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun allocationPrice(allocationPrice: JsonField) = apply { + this.allocationPrice = allocationPrice + } - fun scalableMatrixWithUnitPricing(): Optional = - Optional.ofNullable(scalableMatrixWithUnitPricing) + /** The phase to add this price to. */ + fun planPhaseOrder(planPhaseOrder: Long?) = + planPhaseOrder(JsonField.ofNullable(planPhaseOrder)) - fun scalableMatrixWithTieredPricing(): - Optional = - Optional.ofNullable(scalableMatrixWithTieredPricing) + /** + * Alias for [Builder.planPhaseOrder]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(planPhaseOrder as Long?) - fun cumulativeGroupedBulk(): Optional = - Optional.ofNullable(cumulativeGroupedBulk) + /** Alias for calling [Builder.planPhaseOrder] with `planPhaseOrder.orElse(null)`. */ + fun planPhaseOrder(planPhaseOrder: Optional) = + planPhaseOrder(planPhaseOrder.getOrNull()) - fun tieredPackageWithMinimum(): Optional = - Optional.ofNullable(tieredPackageWithMinimum) + /** + * Sets [Builder.planPhaseOrder] to an arbitrary JSON value. + * + * You should usually call [Builder.planPhaseOrder] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } - fun matrixWithAllocation(): Optional = - Optional.ofNullable(matrixWithAllocation) + /** The price to add to the plan */ + fun price(price: InnerPrice?) = price(JsonField.ofNullable(price)) - fun groupedTiered(): Optional = - Optional.ofNullable(groupedTiered) + /** Alias for calling [Builder.price] with `price.orElse(null)`. */ + fun price(price: Optional) = price(price.getOrNull()) - fun isUnit(): Boolean = unit != null + /** + * Sets [Builder.price] to an arbitrary JSON value. + * + * You should usually call [Builder.price] with a well-typed [InnerPrice] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun price(price: JsonField) = apply { this.price = price } - fun isPackage(): Boolean = package_ != null + /** Alias for calling [price] with `InnerPrice.ofUnit(unit)`. */ + fun price(unit: NewPlanUnitPrice) = price(InnerPrice.ofUnit(unit)) - fun isMatrix(): Boolean = matrix != null + /** Alias for calling [price] with `InnerPrice.ofPackage(package_)`. */ + fun price(package_: NewPlanPackagePrice) = price(InnerPrice.ofPackage(package_)) - fun isTiered(): Boolean = tiered != null + /** Alias for calling [price] with `InnerPrice.ofMatrix(matrix)`. */ + fun price(matrix: NewPlanMatrixPrice) = price(InnerPrice.ofMatrix(matrix)) - fun isTieredBps(): Boolean = tieredBps != null + /** Alias for calling [price] with `InnerPrice.ofTiered(tiered)`. */ + fun price(tiered: NewPlanTieredPrice) = price(InnerPrice.ofTiered(tiered)) - fun isBps(): Boolean = bps != null + /** Alias for calling [price] with `InnerPrice.ofTieredBps(tieredBps)`. */ + fun price(tieredBps: NewPlanTieredBpsPrice) = price(InnerPrice.ofTieredBps(tieredBps)) - fun isBulkBps(): Boolean = bulkBps != null + /** Alias for calling [price] with `InnerPrice.ofBps(bps)`. */ + fun price(bps: NewPlanBpsPrice) = price(InnerPrice.ofBps(bps)) - fun isBulk(): Boolean = bulk != null + /** Alias for calling [price] with `InnerPrice.ofBulkBps(bulkBps)`. */ + fun price(bulkBps: NewPlanBulkBpsPrice) = price(InnerPrice.ofBulkBps(bulkBps)) - fun isThresholdTotalAmount(): Boolean = thresholdTotalAmount != null + /** Alias for calling [price] with `InnerPrice.ofBulk(bulk)`. */ + fun price(bulk: NewPlanBulkPrice) = price(InnerPrice.ofBulk(bulk)) - fun isTieredPackage(): Boolean = tieredPackage != null + /** + * Alias for calling [price] with + * `InnerPrice.ofThresholdTotalAmount(thresholdTotalAmount)`. + */ + fun price(thresholdTotalAmount: NewPlanThresholdTotalAmountPrice) = + price(InnerPrice.ofThresholdTotalAmount(thresholdTotalAmount)) - fun isTieredWithMinimum(): Boolean = tieredWithMinimum != null + /** Alias for calling [price] with `InnerPrice.ofTieredPackage(tieredPackage)`. */ + fun price(tieredPackage: NewPlanTieredPackagePrice) = + price(InnerPrice.ofTieredPackage(tieredPackage)) - fun isUnitWithPercent(): Boolean = unitWithPercent != null + /** + * Alias for calling [price] with `InnerPrice.ofTieredWithMinimum(tieredWithMinimum)`. + */ + fun price(tieredWithMinimum: NewPlanTieredWithMinimumPrice) = + price(InnerPrice.ofTieredWithMinimum(tieredWithMinimum)) - fun isPackageWithAllocation(): Boolean = packageWithAllocation != null + /** Alias for calling [price] with `InnerPrice.ofUnitWithPercent(unitWithPercent)`. */ + fun price(unitWithPercent: NewPlanUnitWithPercentPrice) = + price(InnerPrice.ofUnitWithPercent(unitWithPercent)) - fun isTieredWithProration(): Boolean = tieredWithProration != null + /** + * Alias for calling [price] with + * `InnerPrice.ofPackageWithAllocation(packageWithAllocation)`. + */ + fun price(packageWithAllocation: NewPlanPackageWithAllocationPrice) = + price(InnerPrice.ofPackageWithAllocation(packageWithAllocation)) - fun isUnitWithProration(): Boolean = unitWithProration != null + /** + * Alias for calling [price] with + * `InnerPrice.ofTieredWithProration(tieredWithProration)`. + */ + fun price(tieredWithProration: NewPlanTierWithProrationPrice) = + price(InnerPrice.ofTieredWithProration(tieredWithProration)) - fun isGroupedAllocation(): Boolean = groupedAllocation != null + /** + * Alias for calling [price] with `InnerPrice.ofUnitWithProration(unitWithProration)`. + */ + fun price(unitWithProration: NewPlanUnitWithProrationPrice) = + price(InnerPrice.ofUnitWithProration(unitWithProration)) - fun isGroupedWithProratedMinimum(): Boolean = groupedWithProratedMinimum != null + /** + * Alias for calling [price] with `InnerPrice.ofGroupedAllocation(groupedAllocation)`. + */ + fun price(groupedAllocation: NewPlanGroupedAllocationPrice) = + price(InnerPrice.ofGroupedAllocation(groupedAllocation)) - fun isGroupedWithMeteredMinimum(): Boolean = groupedWithMeteredMinimum != null + /** + * Alias for calling [price] with + * `InnerPrice.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`. + */ + fun price(groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice) = + price(InnerPrice.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)) - fun isMatrixWithDisplayName(): Boolean = matrixWithDisplayName != null + /** + * Alias for calling [price] with + * `InnerPrice.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`. + */ + fun price(groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice) = + price(InnerPrice.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)) - fun isBulkWithProration(): Boolean = bulkWithProration != null + /** + * Alias for calling [price] with + * `InnerPrice.ofMatrixWithDisplayName(matrixWithDisplayName)`. + */ + fun price(matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice) = + price(InnerPrice.ofMatrixWithDisplayName(matrixWithDisplayName)) - fun isGroupedTieredPackage(): Boolean = groupedTieredPackage != null + /** + * Alias for calling [price] with `InnerPrice.ofBulkWithProration(bulkWithProration)`. + */ + fun price(bulkWithProration: NewPlanBulkWithProrationPrice) = + price(InnerPrice.ofBulkWithProration(bulkWithProration)) - fun isMaxGroupTieredPackage(): Boolean = maxGroupTieredPackage != null + /** + * Alias for calling [price] with + * `InnerPrice.ofGroupedTieredPackage(groupedTieredPackage)`. + */ + fun price(groupedTieredPackage: NewPlanGroupedTieredPackagePrice) = + price(InnerPrice.ofGroupedTieredPackage(groupedTieredPackage)) - fun isScalableMatrixWithUnitPricing(): Boolean = scalableMatrixWithUnitPricing != null + /** + * Alias for calling [price] with + * `InnerPrice.ofMaxGroupTieredPackage(maxGroupTieredPackage)`. + */ + fun price(maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice) = + price(InnerPrice.ofMaxGroupTieredPackage(maxGroupTieredPackage)) - fun isScalableMatrixWithTieredPricing(): Boolean = scalableMatrixWithTieredPricing != null + /** + * Alias for calling [price] with + * `InnerPrice.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`. + */ + fun price(scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice) = + price(InnerPrice.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)) - fun isCumulativeGroupedBulk(): Boolean = cumulativeGroupedBulk != null + /** + * Alias for calling [price] with + * `InnerPrice.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`. + */ + fun price( + scalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice + ) = price(InnerPrice.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)) - fun isTieredPackageWithMinimum(): Boolean = tieredPackageWithMinimum != null + /** + * Alias for calling [price] with + * `InnerPrice.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`. + */ + fun price(cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice) = + price(InnerPrice.ofCumulativeGroupedBulk(cumulativeGroupedBulk)) - fun isMatrixWithAllocation(): Boolean = matrixWithAllocation != null + /** + * Alias for calling [price] with + * `InnerPrice.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`. + */ + fun price(tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice) = + price(InnerPrice.ofTieredPackageWithMinimum(tieredPackageWithMinimum)) - fun isGroupedTiered(): Boolean = groupedTiered != null + /** + * Alias for calling [price] with + * `InnerPrice.ofMatrixWithAllocation(matrixWithAllocation)`. + */ + fun price(matrixWithAllocation: NewPlanMatrixWithAllocationPrice) = + price(InnerPrice.ofMatrixWithAllocation(matrixWithAllocation)) - fun asUnit(): NewPlanUnitPrice = unit.getOrThrow("unit") + /** Alias for calling [price] with `InnerPrice.ofGroupedTiered(groupedTiered)`. */ + fun price(groupedTiered: NewPlanGroupedTieredPrice) = + price(InnerPrice.ofGroupedTiered(groupedTiered)) - fun asPackage(): NewPlanPackagePrice = package_.getOrThrow("package_") + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun asMatrix(): NewPlanMatrixPrice = matrix.getOrThrow("matrix") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun asTiered(): NewPlanTieredPrice = tiered.getOrThrow("tiered") + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun asTieredBps(): NewPlanTieredBpsPrice = tieredBps.getOrThrow("tieredBps") + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - fun asBps(): NewPlanBpsPrice = bps.getOrThrow("bps") + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun asBulkBps(): NewPlanBulkBpsPrice = bulkBps.getOrThrow("bulkBps") + /** + * Returns an immutable instance of [Price]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Price = + Price(allocationPrice, planPhaseOrder, price, additionalProperties.toMutableMap()) + } - fun asBulk(): NewPlanBulkPrice = bulk.getOrThrow("bulk") + private var validated: Boolean = false - fun asThresholdTotalAmount(): NewPlanThresholdTotalAmountPrice = - thresholdTotalAmount.getOrThrow("thresholdTotalAmount") + fun validate(): Price = apply { + if (validated) { + return@apply + } - fun asTieredPackage(): NewPlanTieredPackagePrice = tieredPackage.getOrThrow("tieredPackage") + allocationPrice().ifPresent { it.validate() } + planPhaseOrder() + price().ifPresent { it.validate() } + validated = true + } - fun asTieredWithMinimum(): NewPlanTieredWithMinimumPrice = - tieredWithMinimum.getOrThrow("tieredWithMinimum") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OrbInvalidDataException) { + false + } - fun asUnitWithPercent(): NewPlanUnitWithPercentPrice = - unitWithPercent.getOrThrow("unitWithPercent") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (allocationPrice.asKnown().getOrNull()?.validity() ?: 0) + + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + + (price.asKnown().getOrNull()?.validity() ?: 0) + + /** The price to add to the plan */ + @JsonDeserialize(using = InnerPrice.Deserializer::class) + @JsonSerialize(using = InnerPrice.Serializer::class) + class InnerPrice + private constructor( + private val unit: NewPlanUnitPrice? = null, + private val package_: NewPlanPackagePrice? = null, + private val matrix: NewPlanMatrixPrice? = null, + private val tiered: NewPlanTieredPrice? = null, + private val tieredBps: NewPlanTieredBpsPrice? = null, + private val bps: NewPlanBpsPrice? = null, + private val bulkBps: NewPlanBulkBpsPrice? = null, + private val bulk: NewPlanBulkPrice? = null, + private val thresholdTotalAmount: NewPlanThresholdTotalAmountPrice? = null, + private val tieredPackage: NewPlanTieredPackagePrice? = null, + private val tieredWithMinimum: NewPlanTieredWithMinimumPrice? = null, + private val unitWithPercent: NewPlanUnitWithPercentPrice? = null, + private val packageWithAllocation: NewPlanPackageWithAllocationPrice? = null, + private val tieredWithProration: NewPlanTierWithProrationPrice? = null, + private val unitWithProration: NewPlanUnitWithProrationPrice? = null, + private val groupedAllocation: NewPlanGroupedAllocationPrice? = null, + private val groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice? = null, + private val groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice? = null, + private val matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice? = null, + private val bulkWithProration: NewPlanBulkWithProrationPrice? = null, + private val groupedTieredPackage: NewPlanGroupedTieredPackagePrice? = null, + private val maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice? = null, + private val scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice? = + null, + private val scalableMatrixWithTieredPricing: + NewPlanScalableMatrixWithTieredPricingPrice? = + null, + private val cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice? = null, + private val tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice? = null, + private val matrixWithAllocation: NewPlanMatrixWithAllocationPrice? = null, + private val groupedTiered: NewPlanGroupedTieredPrice? = null, + private val _json: JsonValue? = null, + ) { - fun asPackageWithAllocation(): NewPlanPackageWithAllocationPrice = - packageWithAllocation.getOrThrow("packageWithAllocation") + fun unit(): Optional = Optional.ofNullable(unit) - fun asTieredWithProration(): NewPlanTierWithProrationPrice = - tieredWithProration.getOrThrow("tieredWithProration") + fun package_(): Optional = Optional.ofNullable(package_) - fun asUnitWithProration(): NewPlanUnitWithProrationPrice = - unitWithProration.getOrThrow("unitWithProration") + fun matrix(): Optional = Optional.ofNullable(matrix) - fun asGroupedAllocation(): NewPlanGroupedAllocationPrice = - groupedAllocation.getOrThrow("groupedAllocation") + fun tiered(): Optional = Optional.ofNullable(tiered) - fun asGroupedWithProratedMinimum(): NewPlanGroupedWithProratedMinimumPrice = - groupedWithProratedMinimum.getOrThrow("groupedWithProratedMinimum") + fun tieredBps(): Optional = Optional.ofNullable(tieredBps) - fun asGroupedWithMeteredMinimum(): NewPlanGroupedWithMeteredMinimumPrice = - groupedWithMeteredMinimum.getOrThrow("groupedWithMeteredMinimum") + fun bps(): Optional = Optional.ofNullable(bps) - fun asMatrixWithDisplayName(): NewPlanMatrixWithDisplayNamePrice = - matrixWithDisplayName.getOrThrow("matrixWithDisplayName") + fun bulkBps(): Optional = Optional.ofNullable(bulkBps) - fun asBulkWithProration(): NewPlanBulkWithProrationPrice = - bulkWithProration.getOrThrow("bulkWithProration") + fun bulk(): Optional = Optional.ofNullable(bulk) - fun asGroupedTieredPackage(): NewPlanGroupedTieredPackagePrice = - groupedTieredPackage.getOrThrow("groupedTieredPackage") + fun thresholdTotalAmount(): Optional = + Optional.ofNullable(thresholdTotalAmount) - fun asMaxGroupTieredPackage(): NewPlanMaxGroupTieredPackagePrice = - maxGroupTieredPackage.getOrThrow("maxGroupTieredPackage") + fun tieredPackage(): Optional = + Optional.ofNullable(tieredPackage) - fun asScalableMatrixWithUnitPricing(): NewPlanScalableMatrixWithUnitPricingPrice = - scalableMatrixWithUnitPricing.getOrThrow("scalableMatrixWithUnitPricing") + fun tieredWithMinimum(): Optional = + Optional.ofNullable(tieredWithMinimum) - fun asScalableMatrixWithTieredPricing(): NewPlanScalableMatrixWithTieredPricingPrice = - scalableMatrixWithTieredPricing.getOrThrow("scalableMatrixWithTieredPricing") + fun unitWithPercent(): Optional = + Optional.ofNullable(unitWithPercent) - fun asCumulativeGroupedBulk(): NewPlanCumulativeGroupedBulkPrice = - cumulativeGroupedBulk.getOrThrow("cumulativeGroupedBulk") + fun packageWithAllocation(): Optional = + Optional.ofNullable(packageWithAllocation) - fun asTieredPackageWithMinimum(): NewPlanTieredPackageWithMinimumPrice = - tieredPackageWithMinimum.getOrThrow("tieredPackageWithMinimum") + fun tieredWithProration(): Optional = + Optional.ofNullable(tieredWithProration) - fun asMatrixWithAllocation(): NewPlanMatrixWithAllocationPrice = - matrixWithAllocation.getOrThrow("matrixWithAllocation") + fun unitWithProration(): Optional = + Optional.ofNullable(unitWithProration) - fun asGroupedTiered(): NewPlanGroupedTieredPrice = groupedTiered.getOrThrow("groupedTiered") + fun groupedAllocation(): Optional = + Optional.ofNullable(groupedAllocation) - fun _json(): Optional = Optional.ofNullable(_json) + fun groupedWithProratedMinimum(): Optional = + Optional.ofNullable(groupedWithProratedMinimum) - fun accept(visitor: Visitor): T = - when { - unit != null -> visitor.visitUnit(unit) - package_ != null -> visitor.visitPackage(package_) - matrix != null -> visitor.visitMatrix(matrix) - tiered != null -> visitor.visitTiered(tiered) - tieredBps != null -> visitor.visitTieredBps(tieredBps) - bps != null -> visitor.visitBps(bps) - bulkBps != null -> visitor.visitBulkBps(bulkBps) - bulk != null -> visitor.visitBulk(bulk) - thresholdTotalAmount != null -> - visitor.visitThresholdTotalAmount(thresholdTotalAmount) - tieredPackage != null -> visitor.visitTieredPackage(tieredPackage) - tieredWithMinimum != null -> visitor.visitTieredWithMinimum(tieredWithMinimum) - unitWithPercent != null -> visitor.visitUnitWithPercent(unitWithPercent) - packageWithAllocation != null -> - visitor.visitPackageWithAllocation(packageWithAllocation) - tieredWithProration != null -> visitor.visitTieredWithProration(tieredWithProration) - unitWithProration != null -> visitor.visitUnitWithProration(unitWithProration) - groupedAllocation != null -> visitor.visitGroupedAllocation(groupedAllocation) - groupedWithProratedMinimum != null -> - visitor.visitGroupedWithProratedMinimum(groupedWithProratedMinimum) - groupedWithMeteredMinimum != null -> - visitor.visitGroupedWithMeteredMinimum(groupedWithMeteredMinimum) - matrixWithDisplayName != null -> - visitor.visitMatrixWithDisplayName(matrixWithDisplayName) - bulkWithProration != null -> visitor.visitBulkWithProration(bulkWithProration) - groupedTieredPackage != null -> - visitor.visitGroupedTieredPackage(groupedTieredPackage) - maxGroupTieredPackage != null -> - visitor.visitMaxGroupTieredPackage(maxGroupTieredPackage) - scalableMatrixWithUnitPricing != null -> - visitor.visitScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing) - scalableMatrixWithTieredPricing != null -> - visitor.visitScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing) - cumulativeGroupedBulk != null -> - visitor.visitCumulativeGroupedBulk(cumulativeGroupedBulk) - tieredPackageWithMinimum != null -> - visitor.visitTieredPackageWithMinimum(tieredPackageWithMinimum) - matrixWithAllocation != null -> - visitor.visitMatrixWithAllocation(matrixWithAllocation) - groupedTiered != null -> visitor.visitGroupedTiered(groupedTiered) - else -> visitor.unknown(_json) - } + fun groupedWithMeteredMinimum(): Optional = + Optional.ofNullable(groupedWithMeteredMinimum) - private var validated: Boolean = false + fun matrixWithDisplayName(): Optional = + Optional.ofNullable(matrixWithDisplayName) - fun validate(): Price = apply { - if (validated) { - return@apply - } + fun bulkWithProration(): Optional = + Optional.ofNullable(bulkWithProration) - accept( - object : Visitor { - override fun visitUnit(unit: NewPlanUnitPrice) { - unit.validate() - } + fun groupedTieredPackage(): Optional = + Optional.ofNullable(groupedTieredPackage) - override fun visitPackage(package_: NewPlanPackagePrice) { - package_.validate() - } + fun maxGroupTieredPackage(): Optional = + Optional.ofNullable(maxGroupTieredPackage) - override fun visitMatrix(matrix: NewPlanMatrixPrice) { - matrix.validate() - } + fun scalableMatrixWithUnitPricing(): + Optional = + Optional.ofNullable(scalableMatrixWithUnitPricing) - override fun visitTiered(tiered: NewPlanTieredPrice) { - tiered.validate() - } + fun scalableMatrixWithTieredPricing(): + Optional = + Optional.ofNullable(scalableMatrixWithTieredPricing) - override fun visitTieredBps(tieredBps: NewPlanTieredBpsPrice) { - tieredBps.validate() - } + fun cumulativeGroupedBulk(): Optional = + Optional.ofNullable(cumulativeGroupedBulk) - override fun visitBps(bps: NewPlanBpsPrice) { - bps.validate() - } + fun tieredPackageWithMinimum(): Optional = + Optional.ofNullable(tieredPackageWithMinimum) - override fun visitBulkBps(bulkBps: NewPlanBulkBpsPrice) { - bulkBps.validate() - } + fun matrixWithAllocation(): Optional = + Optional.ofNullable(matrixWithAllocation) - override fun visitBulk(bulk: NewPlanBulkPrice) { - bulk.validate() - } + fun groupedTiered(): Optional = + Optional.ofNullable(groupedTiered) - override fun visitThresholdTotalAmount( - thresholdTotalAmount: NewPlanThresholdTotalAmountPrice - ) { - thresholdTotalAmount.validate() - } + fun isUnit(): Boolean = unit != null - override fun visitTieredPackage(tieredPackage: NewPlanTieredPackagePrice) { - tieredPackage.validate() - } + fun isPackage(): Boolean = package_ != null - override fun visitTieredWithMinimum( - tieredWithMinimum: NewPlanTieredWithMinimumPrice - ) { - tieredWithMinimum.validate() - } + fun isMatrix(): Boolean = matrix != null - override fun visitUnitWithPercent( - unitWithPercent: NewPlanUnitWithPercentPrice - ) { - unitWithPercent.validate() - } + fun isTiered(): Boolean = tiered != null - override fun visitPackageWithAllocation( - packageWithAllocation: NewPlanPackageWithAllocationPrice - ) { - packageWithAllocation.validate() - } + fun isTieredBps(): Boolean = tieredBps != null - override fun visitTieredWithProration( - tieredWithProration: NewPlanTierWithProrationPrice - ) { - tieredWithProration.validate() - } + fun isBps(): Boolean = bps != null - override fun visitUnitWithProration( - unitWithProration: NewPlanUnitWithProrationPrice - ) { - unitWithProration.validate() - } + fun isBulkBps(): Boolean = bulkBps != null - override fun visitGroupedAllocation( - groupedAllocation: NewPlanGroupedAllocationPrice - ) { - groupedAllocation.validate() - } + fun isBulk(): Boolean = bulk != null - override fun visitGroupedWithProratedMinimum( - groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice - ) { - groupedWithProratedMinimum.validate() - } + fun isThresholdTotalAmount(): Boolean = thresholdTotalAmount != null - override fun visitGroupedWithMeteredMinimum( - groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice - ) { - groupedWithMeteredMinimum.validate() - } + fun isTieredPackage(): Boolean = tieredPackage != null - override fun visitMatrixWithDisplayName( - matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice - ) { - matrixWithDisplayName.validate() - } + fun isTieredWithMinimum(): Boolean = tieredWithMinimum != null - override fun visitBulkWithProration( - bulkWithProration: NewPlanBulkWithProrationPrice - ) { - bulkWithProration.validate() - } + fun isUnitWithPercent(): Boolean = unitWithPercent != null - override fun visitGroupedTieredPackage( - groupedTieredPackage: NewPlanGroupedTieredPackagePrice - ) { - groupedTieredPackage.validate() - } + fun isPackageWithAllocation(): Boolean = packageWithAllocation != null - override fun visitMaxGroupTieredPackage( - maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice - ) { - maxGroupTieredPackage.validate() - } + fun isTieredWithProration(): Boolean = tieredWithProration != null - override fun visitScalableMatrixWithUnitPricing( - scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice - ) { - scalableMatrixWithUnitPricing.validate() - } + fun isUnitWithProration(): Boolean = unitWithProration != null - override fun visitScalableMatrixWithTieredPricing( - scalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice - ) { - scalableMatrixWithTieredPricing.validate() - } + fun isGroupedAllocation(): Boolean = groupedAllocation != null - override fun visitCumulativeGroupedBulk( - cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice - ) { - cumulativeGroupedBulk.validate() - } + fun isGroupedWithProratedMinimum(): Boolean = groupedWithProratedMinimum != null - override fun visitTieredPackageWithMinimum( - tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice - ) { - tieredPackageWithMinimum.validate() - } + fun isGroupedWithMeteredMinimum(): Boolean = groupedWithMeteredMinimum != null - override fun visitMatrixWithAllocation( - matrixWithAllocation: NewPlanMatrixWithAllocationPrice - ) { - matrixWithAllocation.validate() - } + fun isMatrixWithDisplayName(): Boolean = matrixWithDisplayName != null - override fun visitGroupedTiered(groupedTiered: NewPlanGroupedTieredPrice) { - groupedTiered.validate() - } - } - ) - validated = true - } + fun isBulkWithProration(): Boolean = bulkWithProration != null - fun isValid(): Boolean = - try { - validate() - true - } catch (e: OrbInvalidDataException) { - false - } + fun isGroupedTieredPackage(): Boolean = groupedTieredPackage != null - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - accept( - object : Visitor { - override fun visitUnit(unit: NewPlanUnitPrice) = unit.validity() + fun isMaxGroupTieredPackage(): Boolean = maxGroupTieredPackage != null + + fun isScalableMatrixWithUnitPricing(): Boolean = scalableMatrixWithUnitPricing != null + + fun isScalableMatrixWithTieredPricing(): Boolean = + scalableMatrixWithTieredPricing != null + + fun isCumulativeGroupedBulk(): Boolean = cumulativeGroupedBulk != null + + fun isTieredPackageWithMinimum(): Boolean = tieredPackageWithMinimum != null - override fun visitPackage(package_: NewPlanPackagePrice) = package_.validity() + fun isMatrixWithAllocation(): Boolean = matrixWithAllocation != null - override fun visitMatrix(matrix: NewPlanMatrixPrice) = matrix.validity() + fun isGroupedTiered(): Boolean = groupedTiered != null - override fun visitTiered(tiered: NewPlanTieredPrice) = tiered.validity() + fun asUnit(): NewPlanUnitPrice = unit.getOrThrow("unit") - override fun visitTieredBps(tieredBps: NewPlanTieredBpsPrice) = - tieredBps.validity() + fun asPackage(): NewPlanPackagePrice = package_.getOrThrow("package_") - override fun visitBps(bps: NewPlanBpsPrice) = bps.validity() + fun asMatrix(): NewPlanMatrixPrice = matrix.getOrThrow("matrix") - override fun visitBulkBps(bulkBps: NewPlanBulkBpsPrice) = bulkBps.validity() + fun asTiered(): NewPlanTieredPrice = tiered.getOrThrow("tiered") - override fun visitBulk(bulk: NewPlanBulkPrice) = bulk.validity() + fun asTieredBps(): NewPlanTieredBpsPrice = tieredBps.getOrThrow("tieredBps") - override fun visitThresholdTotalAmount( - thresholdTotalAmount: NewPlanThresholdTotalAmountPrice - ) = thresholdTotalAmount.validity() + fun asBps(): NewPlanBpsPrice = bps.getOrThrow("bps") - override fun visitTieredPackage(tieredPackage: NewPlanTieredPackagePrice) = - tieredPackage.validity() + fun asBulkBps(): NewPlanBulkBpsPrice = bulkBps.getOrThrow("bulkBps") - override fun visitTieredWithMinimum( - tieredWithMinimum: NewPlanTieredWithMinimumPrice - ) = tieredWithMinimum.validity() + fun asBulk(): NewPlanBulkPrice = bulk.getOrThrow("bulk") - override fun visitUnitWithPercent( - unitWithPercent: NewPlanUnitWithPercentPrice - ) = unitWithPercent.validity() + fun asThresholdTotalAmount(): NewPlanThresholdTotalAmountPrice = + thresholdTotalAmount.getOrThrow("thresholdTotalAmount") - override fun visitPackageWithAllocation( - packageWithAllocation: NewPlanPackageWithAllocationPrice - ) = packageWithAllocation.validity() + fun asTieredPackage(): NewPlanTieredPackagePrice = + tieredPackage.getOrThrow("tieredPackage") - override fun visitTieredWithProration( - tieredWithProration: NewPlanTierWithProrationPrice - ) = tieredWithProration.validity() + fun asTieredWithMinimum(): NewPlanTieredWithMinimumPrice = + tieredWithMinimum.getOrThrow("tieredWithMinimum") - override fun visitUnitWithProration( - unitWithProration: NewPlanUnitWithProrationPrice - ) = unitWithProration.validity() + fun asUnitWithPercent(): NewPlanUnitWithPercentPrice = + unitWithPercent.getOrThrow("unitWithPercent") - override fun visitGroupedAllocation( - groupedAllocation: NewPlanGroupedAllocationPrice - ) = groupedAllocation.validity() + fun asPackageWithAllocation(): NewPlanPackageWithAllocationPrice = + packageWithAllocation.getOrThrow("packageWithAllocation") - override fun visitGroupedWithProratedMinimum( - groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice - ) = groupedWithProratedMinimum.validity() + fun asTieredWithProration(): NewPlanTierWithProrationPrice = + tieredWithProration.getOrThrow("tieredWithProration") - override fun visitGroupedWithMeteredMinimum( - groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice - ) = groupedWithMeteredMinimum.validity() + fun asUnitWithProration(): NewPlanUnitWithProrationPrice = + unitWithProration.getOrThrow("unitWithProration") - override fun visitMatrixWithDisplayName( - matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice - ) = matrixWithDisplayName.validity() + fun asGroupedAllocation(): NewPlanGroupedAllocationPrice = + groupedAllocation.getOrThrow("groupedAllocation") - override fun visitBulkWithProration( - bulkWithProration: NewPlanBulkWithProrationPrice - ) = bulkWithProration.validity() + fun asGroupedWithProratedMinimum(): NewPlanGroupedWithProratedMinimumPrice = + groupedWithProratedMinimum.getOrThrow("groupedWithProratedMinimum") - override fun visitGroupedTieredPackage( - groupedTieredPackage: NewPlanGroupedTieredPackagePrice - ) = groupedTieredPackage.validity() + fun asGroupedWithMeteredMinimum(): NewPlanGroupedWithMeteredMinimumPrice = + groupedWithMeteredMinimum.getOrThrow("groupedWithMeteredMinimum") - override fun visitMaxGroupTieredPackage( - maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice - ) = maxGroupTieredPackage.validity() + fun asMatrixWithDisplayName(): NewPlanMatrixWithDisplayNamePrice = + matrixWithDisplayName.getOrThrow("matrixWithDisplayName") - override fun visitScalableMatrixWithUnitPricing( - scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice - ) = scalableMatrixWithUnitPricing.validity() + fun asBulkWithProration(): NewPlanBulkWithProrationPrice = + bulkWithProration.getOrThrow("bulkWithProration") - override fun visitScalableMatrixWithTieredPricing( - scalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice - ) = scalableMatrixWithTieredPricing.validity() + fun asGroupedTieredPackage(): NewPlanGroupedTieredPackagePrice = + groupedTieredPackage.getOrThrow("groupedTieredPackage") - override fun visitCumulativeGroupedBulk( - cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice - ) = cumulativeGroupedBulk.validity() + fun asMaxGroupTieredPackage(): NewPlanMaxGroupTieredPackagePrice = + maxGroupTieredPackage.getOrThrow("maxGroupTieredPackage") - override fun visitTieredPackageWithMinimum( - tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice - ) = tieredPackageWithMinimum.validity() + fun asScalableMatrixWithUnitPricing(): NewPlanScalableMatrixWithUnitPricingPrice = + scalableMatrixWithUnitPricing.getOrThrow("scalableMatrixWithUnitPricing") - override fun visitMatrixWithAllocation( - matrixWithAllocation: NewPlanMatrixWithAllocationPrice - ) = matrixWithAllocation.validity() + fun asScalableMatrixWithTieredPricing(): NewPlanScalableMatrixWithTieredPricingPrice = + scalableMatrixWithTieredPricing.getOrThrow("scalableMatrixWithTieredPricing") - override fun visitGroupedTiered(groupedTiered: NewPlanGroupedTieredPrice) = - groupedTiered.validity() + fun asCumulativeGroupedBulk(): NewPlanCumulativeGroupedBulkPrice = + cumulativeGroupedBulk.getOrThrow("cumulativeGroupedBulk") - override fun unknown(json: JsonValue?) = 0 + fun asTieredPackageWithMinimum(): NewPlanTieredPackageWithMinimumPrice = + tieredPackageWithMinimum.getOrThrow("tieredPackageWithMinimum") + + fun asMatrixWithAllocation(): NewPlanMatrixWithAllocationPrice = + matrixWithAllocation.getOrThrow("matrixWithAllocation") + + fun asGroupedTiered(): NewPlanGroupedTieredPrice = + groupedTiered.getOrThrow("groupedTiered") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + unit != null -> visitor.visitUnit(unit) + package_ != null -> visitor.visitPackage(package_) + matrix != null -> visitor.visitMatrix(matrix) + tiered != null -> visitor.visitTiered(tiered) + tieredBps != null -> visitor.visitTieredBps(tieredBps) + bps != null -> visitor.visitBps(bps) + bulkBps != null -> visitor.visitBulkBps(bulkBps) + bulk != null -> visitor.visitBulk(bulk) + thresholdTotalAmount != null -> + visitor.visitThresholdTotalAmount(thresholdTotalAmount) + tieredPackage != null -> visitor.visitTieredPackage(tieredPackage) + tieredWithMinimum != null -> visitor.visitTieredWithMinimum(tieredWithMinimum) + unitWithPercent != null -> visitor.visitUnitWithPercent(unitWithPercent) + packageWithAllocation != null -> + visitor.visitPackageWithAllocation(packageWithAllocation) + tieredWithProration != null -> + visitor.visitTieredWithProration(tieredWithProration) + unitWithProration != null -> visitor.visitUnitWithProration(unitWithProration) + groupedAllocation != null -> visitor.visitGroupedAllocation(groupedAllocation) + groupedWithProratedMinimum != null -> + visitor.visitGroupedWithProratedMinimum(groupedWithProratedMinimum) + groupedWithMeteredMinimum != null -> + visitor.visitGroupedWithMeteredMinimum(groupedWithMeteredMinimum) + matrixWithDisplayName != null -> + visitor.visitMatrixWithDisplayName(matrixWithDisplayName) + bulkWithProration != null -> visitor.visitBulkWithProration(bulkWithProration) + groupedTieredPackage != null -> + visitor.visitGroupedTieredPackage(groupedTieredPackage) + maxGroupTieredPackage != null -> + visitor.visitMaxGroupTieredPackage(maxGroupTieredPackage) + scalableMatrixWithUnitPricing != null -> + visitor.visitScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing) + scalableMatrixWithTieredPricing != null -> + visitor.visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing + ) + cumulativeGroupedBulk != null -> + visitor.visitCumulativeGroupedBulk(cumulativeGroupedBulk) + tieredPackageWithMinimum != null -> + visitor.visitTieredPackageWithMinimum(tieredPackageWithMinimum) + matrixWithAllocation != null -> + visitor.visitMatrixWithAllocation(matrixWithAllocation) + groupedTiered != null -> visitor.visitGroupedTiered(groupedTiered) + else -> visitor.unknown(_json) } - ) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return /* spotless:off */ other is Price && unit == other.unit && package_ == other.package_ && matrix == other.matrix && tiered == other.tiered && tieredBps == other.tieredBps && bps == other.bps && bulkBps == other.bulkBps && bulk == other.bulk && thresholdTotalAmount == other.thresholdTotalAmount && tieredPackage == other.tieredPackage && tieredWithMinimum == other.tieredWithMinimum && unitWithPercent == other.unitWithPercent && packageWithAllocation == other.packageWithAllocation && tieredWithProration == other.tieredWithProration && unitWithProration == other.unitWithProration && groupedAllocation == other.groupedAllocation && groupedWithProratedMinimum == other.groupedWithProratedMinimum && groupedWithMeteredMinimum == other.groupedWithMeteredMinimum && matrixWithDisplayName == other.matrixWithDisplayName && bulkWithProration == other.bulkWithProration && groupedTieredPackage == other.groupedTieredPackage && maxGroupTieredPackage == other.maxGroupTieredPackage && scalableMatrixWithUnitPricing == other.scalableMatrixWithUnitPricing && scalableMatrixWithTieredPricing == other.scalableMatrixWithTieredPricing && cumulativeGroupedBulk == other.cumulativeGroupedBulk && tieredPackageWithMinimum == other.tieredPackageWithMinimum && matrixWithAllocation == other.matrixWithAllocation && groupedTiered == other.groupedTiered /* spotless:on */ - } + fun validate(): InnerPrice = apply { + if (validated) { + return@apply + } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(unit, package_, matrix, tiered, tieredBps, bps, bulkBps, bulk, thresholdTotalAmount, tieredPackage, tieredWithMinimum, unitWithPercent, packageWithAllocation, tieredWithProration, unitWithProration, groupedAllocation, groupedWithProratedMinimum, groupedWithMeteredMinimum, matrixWithDisplayName, bulkWithProration, groupedTieredPackage, maxGroupTieredPackage, scalableMatrixWithUnitPricing, scalableMatrixWithTieredPricing, cumulativeGroupedBulk, tieredPackageWithMinimum, matrixWithAllocation, groupedTiered) /* spotless:on */ - - override fun toString(): String = - when { - unit != null -> "Price{unit=$unit}" - package_ != null -> "Price{package_=$package_}" - matrix != null -> "Price{matrix=$matrix}" - tiered != null -> "Price{tiered=$tiered}" - tieredBps != null -> "Price{tieredBps=$tieredBps}" - bps != null -> "Price{bps=$bps}" - bulkBps != null -> "Price{bulkBps=$bulkBps}" - bulk != null -> "Price{bulk=$bulk}" - thresholdTotalAmount != null -> "Price{thresholdTotalAmount=$thresholdTotalAmount}" - tieredPackage != null -> "Price{tieredPackage=$tieredPackage}" - tieredWithMinimum != null -> "Price{tieredWithMinimum=$tieredWithMinimum}" - unitWithPercent != null -> "Price{unitWithPercent=$unitWithPercent}" - packageWithAllocation != null -> - "Price{packageWithAllocation=$packageWithAllocation}" - tieredWithProration != null -> "Price{tieredWithProration=$tieredWithProration}" - unitWithProration != null -> "Price{unitWithProration=$unitWithProration}" - groupedAllocation != null -> "Price{groupedAllocation=$groupedAllocation}" - groupedWithProratedMinimum != null -> - "Price{groupedWithProratedMinimum=$groupedWithProratedMinimum}" - groupedWithMeteredMinimum != null -> - "Price{groupedWithMeteredMinimum=$groupedWithMeteredMinimum}" - matrixWithDisplayName != null -> - "Price{matrixWithDisplayName=$matrixWithDisplayName}" - bulkWithProration != null -> "Price{bulkWithProration=$bulkWithProration}" - groupedTieredPackage != null -> "Price{groupedTieredPackage=$groupedTieredPackage}" - maxGroupTieredPackage != null -> - "Price{maxGroupTieredPackage=$maxGroupTieredPackage}" - scalableMatrixWithUnitPricing != null -> - "Price{scalableMatrixWithUnitPricing=$scalableMatrixWithUnitPricing}" - scalableMatrixWithTieredPricing != null -> - "Price{scalableMatrixWithTieredPricing=$scalableMatrixWithTieredPricing}" - cumulativeGroupedBulk != null -> - "Price{cumulativeGroupedBulk=$cumulativeGroupedBulk}" - tieredPackageWithMinimum != null -> - "Price{tieredPackageWithMinimum=$tieredPackageWithMinimum}" - matrixWithAllocation != null -> "Price{matrixWithAllocation=$matrixWithAllocation}" - groupedTiered != null -> "Price{groupedTiered=$groupedTiered}" - _json != null -> "Price{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Price") + accept( + object : Visitor { + override fun visitUnit(unit: NewPlanUnitPrice) { + unit.validate() + } + + override fun visitPackage(package_: NewPlanPackagePrice) { + package_.validate() + } + + override fun visitMatrix(matrix: NewPlanMatrixPrice) { + matrix.validate() + } + + override fun visitTiered(tiered: NewPlanTieredPrice) { + tiered.validate() + } + + override fun visitTieredBps(tieredBps: NewPlanTieredBpsPrice) { + tieredBps.validate() + } + + override fun visitBps(bps: NewPlanBpsPrice) { + bps.validate() + } + + override fun visitBulkBps(bulkBps: NewPlanBulkBpsPrice) { + bulkBps.validate() + } + + override fun visitBulk(bulk: NewPlanBulkPrice) { + bulk.validate() + } + + override fun visitThresholdTotalAmount( + thresholdTotalAmount: NewPlanThresholdTotalAmountPrice + ) { + thresholdTotalAmount.validate() + } + + override fun visitTieredPackage(tieredPackage: NewPlanTieredPackagePrice) { + tieredPackage.validate() + } + + override fun visitTieredWithMinimum( + tieredWithMinimum: NewPlanTieredWithMinimumPrice + ) { + tieredWithMinimum.validate() + } + + override fun visitUnitWithPercent( + unitWithPercent: NewPlanUnitWithPercentPrice + ) { + unitWithPercent.validate() + } + + override fun visitPackageWithAllocation( + packageWithAllocation: NewPlanPackageWithAllocationPrice + ) { + packageWithAllocation.validate() + } + + override fun visitTieredWithProration( + tieredWithProration: NewPlanTierWithProrationPrice + ) { + tieredWithProration.validate() + } + + override fun visitUnitWithProration( + unitWithProration: NewPlanUnitWithProrationPrice + ) { + unitWithProration.validate() + } + + override fun visitGroupedAllocation( + groupedAllocation: NewPlanGroupedAllocationPrice + ) { + groupedAllocation.validate() + } + + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice + ) { + groupedWithProratedMinimum.validate() + } + + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice + ) { + groupedWithMeteredMinimum.validate() + } + + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice + ) { + matrixWithDisplayName.validate() + } + + override fun visitBulkWithProration( + bulkWithProration: NewPlanBulkWithProrationPrice + ) { + bulkWithProration.validate() + } + + override fun visitGroupedTieredPackage( + groupedTieredPackage: NewPlanGroupedTieredPackagePrice + ) { + groupedTieredPackage.validate() + } + + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice + ) { + maxGroupTieredPackage.validate() + } + + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice + ) { + scalableMatrixWithUnitPricing.validate() + } + + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: + NewPlanScalableMatrixWithTieredPricingPrice + ) { + scalableMatrixWithTieredPricing.validate() + } + + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice + ) { + cumulativeGroupedBulk.validate() + } + + override fun visitTieredPackageWithMinimum( + tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice + ) { + tieredPackageWithMinimum.validate() + } + + override fun visitMatrixWithAllocation( + matrixWithAllocation: NewPlanMatrixWithAllocationPrice + ) { + matrixWithAllocation.validate() + } + + override fun visitGroupedTiered(groupedTiered: NewPlanGroupedTieredPrice) { + groupedTiered.validate() + } + } + ) + validated = true } - companion object { + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OrbInvalidDataException) { + false + } - @JvmStatic fun ofUnit(unit: NewPlanUnitPrice) = Price(unit = unit) + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitUnit(unit: NewPlanUnitPrice) = unit.validity() - @JvmStatic fun ofPackage(package_: NewPlanPackagePrice) = Price(package_ = package_) + override fun visitPackage(package_: NewPlanPackagePrice) = + package_.validity() - @JvmStatic fun ofMatrix(matrix: NewPlanMatrixPrice) = Price(matrix = matrix) + override fun visitMatrix(matrix: NewPlanMatrixPrice) = matrix.validity() - @JvmStatic fun ofTiered(tiered: NewPlanTieredPrice) = Price(tiered = tiered) + override fun visitTiered(tiered: NewPlanTieredPrice) = tiered.validity() - @JvmStatic - fun ofTieredBps(tieredBps: NewPlanTieredBpsPrice) = Price(tieredBps = tieredBps) + override fun visitTieredBps(tieredBps: NewPlanTieredBpsPrice) = + tieredBps.validity() - @JvmStatic fun ofBps(bps: NewPlanBpsPrice) = Price(bps = bps) + override fun visitBps(bps: NewPlanBpsPrice) = bps.validity() - @JvmStatic fun ofBulkBps(bulkBps: NewPlanBulkBpsPrice) = Price(bulkBps = bulkBps) + override fun visitBulkBps(bulkBps: NewPlanBulkBpsPrice) = bulkBps.validity() - @JvmStatic fun ofBulk(bulk: NewPlanBulkPrice) = Price(bulk = bulk) + override fun visitBulk(bulk: NewPlanBulkPrice) = bulk.validity() - @JvmStatic - fun ofThresholdTotalAmount(thresholdTotalAmount: NewPlanThresholdTotalAmountPrice) = - Price(thresholdTotalAmount = thresholdTotalAmount) + override fun visitThresholdTotalAmount( + thresholdTotalAmount: NewPlanThresholdTotalAmountPrice + ) = thresholdTotalAmount.validity() - @JvmStatic - fun ofTieredPackage(tieredPackage: NewPlanTieredPackagePrice) = - Price(tieredPackage = tieredPackage) + override fun visitTieredPackage(tieredPackage: NewPlanTieredPackagePrice) = + tieredPackage.validity() - @JvmStatic - fun ofTieredWithMinimum(tieredWithMinimum: NewPlanTieredWithMinimumPrice) = - Price(tieredWithMinimum = tieredWithMinimum) + override fun visitTieredWithMinimum( + tieredWithMinimum: NewPlanTieredWithMinimumPrice + ) = tieredWithMinimum.validity() - @JvmStatic - fun ofUnitWithPercent(unitWithPercent: NewPlanUnitWithPercentPrice) = - Price(unitWithPercent = unitWithPercent) + override fun visitUnitWithPercent( + unitWithPercent: NewPlanUnitWithPercentPrice + ) = unitWithPercent.validity() - @JvmStatic - fun ofPackageWithAllocation(packageWithAllocation: NewPlanPackageWithAllocationPrice) = - Price(packageWithAllocation = packageWithAllocation) + override fun visitPackageWithAllocation( + packageWithAllocation: NewPlanPackageWithAllocationPrice + ) = packageWithAllocation.validity() - @JvmStatic - fun ofTieredWithProration(tieredWithProration: NewPlanTierWithProrationPrice) = - Price(tieredWithProration = tieredWithProration) + override fun visitTieredWithProration( + tieredWithProration: NewPlanTierWithProrationPrice + ) = tieredWithProration.validity() - @JvmStatic - fun ofUnitWithProration(unitWithProration: NewPlanUnitWithProrationPrice) = - Price(unitWithProration = unitWithProration) + override fun visitUnitWithProration( + unitWithProration: NewPlanUnitWithProrationPrice + ) = unitWithProration.validity() - @JvmStatic - fun ofGroupedAllocation(groupedAllocation: NewPlanGroupedAllocationPrice) = - Price(groupedAllocation = groupedAllocation) + override fun visitGroupedAllocation( + groupedAllocation: NewPlanGroupedAllocationPrice + ) = groupedAllocation.validity() - @JvmStatic - fun ofGroupedWithProratedMinimum( - groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice - ) = Price(groupedWithProratedMinimum = groupedWithProratedMinimum) + override fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice + ) = groupedWithProratedMinimum.validity() - @JvmStatic - fun ofGroupedWithMeteredMinimum( - groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice - ) = Price(groupedWithMeteredMinimum = groupedWithMeteredMinimum) + override fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice + ) = groupedWithMeteredMinimum.validity() - @JvmStatic - fun ofMatrixWithDisplayName(matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice) = - Price(matrixWithDisplayName = matrixWithDisplayName) + override fun visitMatrixWithDisplayName( + matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice + ) = matrixWithDisplayName.validity() - @JvmStatic - fun ofBulkWithProration(bulkWithProration: NewPlanBulkWithProrationPrice) = - Price(bulkWithProration = bulkWithProration) + override fun visitBulkWithProration( + bulkWithProration: NewPlanBulkWithProrationPrice + ) = bulkWithProration.validity() - @JvmStatic - fun ofGroupedTieredPackage(groupedTieredPackage: NewPlanGroupedTieredPackagePrice) = - Price(groupedTieredPackage = groupedTieredPackage) + override fun visitGroupedTieredPackage( + groupedTieredPackage: NewPlanGroupedTieredPackagePrice + ) = groupedTieredPackage.validity() - @JvmStatic - fun ofMaxGroupTieredPackage(maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice) = - Price(maxGroupTieredPackage = maxGroupTieredPackage) + override fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice + ) = maxGroupTieredPackage.validity() - @JvmStatic - fun ofScalableMatrixWithUnitPricing( - scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice - ) = Price(scalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing) + override fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice + ) = scalableMatrixWithUnitPricing.validity() - @JvmStatic - fun ofScalableMatrixWithTieredPricing( - scalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice - ) = Price(scalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing) + override fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: + NewPlanScalableMatrixWithTieredPricingPrice + ) = scalableMatrixWithTieredPricing.validity() - @JvmStatic - fun ofCumulativeGroupedBulk(cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice) = - Price(cumulativeGroupedBulk = cumulativeGroupedBulk) + override fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice + ) = cumulativeGroupedBulk.validity() - @JvmStatic - fun ofTieredPackageWithMinimum( - tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice - ) = Price(tieredPackageWithMinimum = tieredPackageWithMinimum) + override fun visitTieredPackageWithMinimum( + tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice + ) = tieredPackageWithMinimum.validity() - @JvmStatic - fun ofMatrixWithAllocation(matrixWithAllocation: NewPlanMatrixWithAllocationPrice) = - Price(matrixWithAllocation = matrixWithAllocation) + override fun visitMatrixWithAllocation( + matrixWithAllocation: NewPlanMatrixWithAllocationPrice + ) = matrixWithAllocation.validity() - @JvmStatic - fun ofGroupedTiered(groupedTiered: NewPlanGroupedTieredPrice) = - Price(groupedTiered = groupedTiered) - } + override fun visitGroupedTiered(groupedTiered: NewPlanGroupedTieredPrice) = + groupedTiered.validity() - /** An interface that defines how to map each variant of [Price] to a value of type [T]. */ - interface Visitor { + override fun unknown(json: JsonValue?) = 0 + } + ) - fun visitUnit(unit: NewPlanUnitPrice): T + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun visitPackage(package_: NewPlanPackagePrice): T + return /* spotless:off */ other is InnerPrice && unit == other.unit && package_ == other.package_ && matrix == other.matrix && tiered == other.tiered && tieredBps == other.tieredBps && bps == other.bps && bulkBps == other.bulkBps && bulk == other.bulk && thresholdTotalAmount == other.thresholdTotalAmount && tieredPackage == other.tieredPackage && tieredWithMinimum == other.tieredWithMinimum && unitWithPercent == other.unitWithPercent && packageWithAllocation == other.packageWithAllocation && tieredWithProration == other.tieredWithProration && unitWithProration == other.unitWithProration && groupedAllocation == other.groupedAllocation && groupedWithProratedMinimum == other.groupedWithProratedMinimum && groupedWithMeteredMinimum == other.groupedWithMeteredMinimum && matrixWithDisplayName == other.matrixWithDisplayName && bulkWithProration == other.bulkWithProration && groupedTieredPackage == other.groupedTieredPackage && maxGroupTieredPackage == other.maxGroupTieredPackage && scalableMatrixWithUnitPricing == other.scalableMatrixWithUnitPricing && scalableMatrixWithTieredPricing == other.scalableMatrixWithTieredPricing && cumulativeGroupedBulk == other.cumulativeGroupedBulk && tieredPackageWithMinimum == other.tieredPackageWithMinimum && matrixWithAllocation == other.matrixWithAllocation && groupedTiered == other.groupedTiered /* spotless:on */ + } - fun visitMatrix(matrix: NewPlanMatrixPrice): T + override fun hashCode(): Int = /* spotless:off */ Objects.hash(unit, package_, matrix, tiered, tieredBps, bps, bulkBps, bulk, thresholdTotalAmount, tieredPackage, tieredWithMinimum, unitWithPercent, packageWithAllocation, tieredWithProration, unitWithProration, groupedAllocation, groupedWithProratedMinimum, groupedWithMeteredMinimum, matrixWithDisplayName, bulkWithProration, groupedTieredPackage, maxGroupTieredPackage, scalableMatrixWithUnitPricing, scalableMatrixWithTieredPricing, cumulativeGroupedBulk, tieredPackageWithMinimum, matrixWithAllocation, groupedTiered) /* spotless:on */ - fun visitTiered(tiered: NewPlanTieredPrice): T + override fun toString(): String = + when { + unit != null -> "InnerPrice{unit=$unit}" + package_ != null -> "InnerPrice{package_=$package_}" + matrix != null -> "InnerPrice{matrix=$matrix}" + tiered != null -> "InnerPrice{tiered=$tiered}" + tieredBps != null -> "InnerPrice{tieredBps=$tieredBps}" + bps != null -> "InnerPrice{bps=$bps}" + bulkBps != null -> "InnerPrice{bulkBps=$bulkBps}" + bulk != null -> "InnerPrice{bulk=$bulk}" + thresholdTotalAmount != null -> + "InnerPrice{thresholdTotalAmount=$thresholdTotalAmount}" + tieredPackage != null -> "InnerPrice{tieredPackage=$tieredPackage}" + tieredWithMinimum != null -> "InnerPrice{tieredWithMinimum=$tieredWithMinimum}" + unitWithPercent != null -> "InnerPrice{unitWithPercent=$unitWithPercent}" + packageWithAllocation != null -> + "InnerPrice{packageWithAllocation=$packageWithAllocation}" + tieredWithProration != null -> + "InnerPrice{tieredWithProration=$tieredWithProration}" + unitWithProration != null -> "InnerPrice{unitWithProration=$unitWithProration}" + groupedAllocation != null -> "InnerPrice{groupedAllocation=$groupedAllocation}" + groupedWithProratedMinimum != null -> + "InnerPrice{groupedWithProratedMinimum=$groupedWithProratedMinimum}" + groupedWithMeteredMinimum != null -> + "InnerPrice{groupedWithMeteredMinimum=$groupedWithMeteredMinimum}" + matrixWithDisplayName != null -> + "InnerPrice{matrixWithDisplayName=$matrixWithDisplayName}" + bulkWithProration != null -> "InnerPrice{bulkWithProration=$bulkWithProration}" + groupedTieredPackage != null -> + "InnerPrice{groupedTieredPackage=$groupedTieredPackage}" + maxGroupTieredPackage != null -> + "InnerPrice{maxGroupTieredPackage=$maxGroupTieredPackage}" + scalableMatrixWithUnitPricing != null -> + "InnerPrice{scalableMatrixWithUnitPricing=$scalableMatrixWithUnitPricing}" + scalableMatrixWithTieredPricing != null -> + "InnerPrice{scalableMatrixWithTieredPricing=$scalableMatrixWithTieredPricing}" + cumulativeGroupedBulk != null -> + "InnerPrice{cumulativeGroupedBulk=$cumulativeGroupedBulk}" + tieredPackageWithMinimum != null -> + "InnerPrice{tieredPackageWithMinimum=$tieredPackageWithMinimum}" + matrixWithAllocation != null -> + "InnerPrice{matrixWithAllocation=$matrixWithAllocation}" + groupedTiered != null -> "InnerPrice{groupedTiered=$groupedTiered}" + _json != null -> "InnerPrice{_unknown=$_json}" + else -> throw IllegalStateException("Invalid InnerPrice") + } - fun visitTieredBps(tieredBps: NewPlanTieredBpsPrice): T + companion object { - fun visitBps(bps: NewPlanBpsPrice): T + @JvmStatic fun ofUnit(unit: NewPlanUnitPrice) = InnerPrice(unit = unit) - fun visitBulkBps(bulkBps: NewPlanBulkBpsPrice): T + @JvmStatic + fun ofPackage(package_: NewPlanPackagePrice) = InnerPrice(package_ = package_) - fun visitBulk(bulk: NewPlanBulkPrice): T + @JvmStatic fun ofMatrix(matrix: NewPlanMatrixPrice) = InnerPrice(matrix = matrix) - fun visitThresholdTotalAmount(thresholdTotalAmount: NewPlanThresholdTotalAmountPrice): T + @JvmStatic fun ofTiered(tiered: NewPlanTieredPrice) = InnerPrice(tiered = tiered) - fun visitTieredPackage(tieredPackage: NewPlanTieredPackagePrice): T + @JvmStatic + fun ofTieredBps(tieredBps: NewPlanTieredBpsPrice) = + InnerPrice(tieredBps = tieredBps) - fun visitTieredWithMinimum(tieredWithMinimum: NewPlanTieredWithMinimumPrice): T + @JvmStatic fun ofBps(bps: NewPlanBpsPrice) = InnerPrice(bps = bps) - fun visitUnitWithPercent(unitWithPercent: NewPlanUnitWithPercentPrice): T + @JvmStatic + fun ofBulkBps(bulkBps: NewPlanBulkBpsPrice) = InnerPrice(bulkBps = bulkBps) - fun visitPackageWithAllocation( - packageWithAllocation: NewPlanPackageWithAllocationPrice - ): T + @JvmStatic fun ofBulk(bulk: NewPlanBulkPrice) = InnerPrice(bulk = bulk) - fun visitTieredWithProration(tieredWithProration: NewPlanTierWithProrationPrice): T + @JvmStatic + fun ofThresholdTotalAmount(thresholdTotalAmount: NewPlanThresholdTotalAmountPrice) = + InnerPrice(thresholdTotalAmount = thresholdTotalAmount) - fun visitUnitWithProration(unitWithProration: NewPlanUnitWithProrationPrice): T + @JvmStatic + fun ofTieredPackage(tieredPackage: NewPlanTieredPackagePrice) = + InnerPrice(tieredPackage = tieredPackage) - fun visitGroupedAllocation(groupedAllocation: NewPlanGroupedAllocationPrice): T + @JvmStatic + fun ofTieredWithMinimum(tieredWithMinimum: NewPlanTieredWithMinimumPrice) = + InnerPrice(tieredWithMinimum = tieredWithMinimum) - fun visitGroupedWithProratedMinimum( - groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice - ): T + @JvmStatic + fun ofUnitWithPercent(unitWithPercent: NewPlanUnitWithPercentPrice) = + InnerPrice(unitWithPercent = unitWithPercent) - fun visitGroupedWithMeteredMinimum( - groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice - ): T + @JvmStatic + fun ofPackageWithAllocation( + packageWithAllocation: NewPlanPackageWithAllocationPrice + ) = InnerPrice(packageWithAllocation = packageWithAllocation) - fun visitMatrixWithDisplayName( - matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice - ): T + @JvmStatic + fun ofTieredWithProration(tieredWithProration: NewPlanTierWithProrationPrice) = + InnerPrice(tieredWithProration = tieredWithProration) - fun visitBulkWithProration(bulkWithProration: NewPlanBulkWithProrationPrice): T + @JvmStatic + fun ofUnitWithProration(unitWithProration: NewPlanUnitWithProrationPrice) = + InnerPrice(unitWithProration = unitWithProration) - fun visitGroupedTieredPackage(groupedTieredPackage: NewPlanGroupedTieredPackagePrice): T + @JvmStatic + fun ofGroupedAllocation(groupedAllocation: NewPlanGroupedAllocationPrice) = + InnerPrice(groupedAllocation = groupedAllocation) - fun visitMaxGroupTieredPackage( - maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice - ): T + @JvmStatic + fun ofGroupedWithProratedMinimum( + groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice + ) = InnerPrice(groupedWithProratedMinimum = groupedWithProratedMinimum) - fun visitScalableMatrixWithUnitPricing( - scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice - ): T + @JvmStatic + fun ofGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice + ) = InnerPrice(groupedWithMeteredMinimum = groupedWithMeteredMinimum) - fun visitScalableMatrixWithTieredPricing( - scalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice - ): T + @JvmStatic + fun ofMatrixWithDisplayName( + matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice + ) = InnerPrice(matrixWithDisplayName = matrixWithDisplayName) - fun visitCumulativeGroupedBulk( - cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice - ): T + @JvmStatic + fun ofBulkWithProration(bulkWithProration: NewPlanBulkWithProrationPrice) = + InnerPrice(bulkWithProration = bulkWithProration) - fun visitTieredPackageWithMinimum( - tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice - ): T + @JvmStatic + fun ofGroupedTieredPackage(groupedTieredPackage: NewPlanGroupedTieredPackagePrice) = + InnerPrice(groupedTieredPackage = groupedTieredPackage) - fun visitMatrixWithAllocation(matrixWithAllocation: NewPlanMatrixWithAllocationPrice): T + @JvmStatic + fun ofMaxGroupTieredPackage( + maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice + ) = InnerPrice(maxGroupTieredPackage = maxGroupTieredPackage) - fun visitGroupedTiered(groupedTiered: NewPlanGroupedTieredPrice): T + @JvmStatic + fun ofScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice + ) = InnerPrice(scalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing) - /** - * Maps an unknown variant of [Price] to a value of type [T]. - * - * An instance of [Price] 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 Price: $json") - } - } + @JvmStatic + fun ofScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice + ) = InnerPrice(scalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing) - internal class Deserializer : BaseDeserializer(Price::class) { + @JvmStatic + fun ofCumulativeGroupedBulk( + cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice + ) = InnerPrice(cumulativeGroupedBulk = cumulativeGroupedBulk) - override fun ObjectCodec.deserialize(node: JsonNode): Price { - val json = JsonValue.fromJsonNode(node) - val modelType = - json.asObject().getOrNull()?.get("model_type")?.asString()?.getOrNull() + @JvmStatic + fun ofTieredPackageWithMinimum( + tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice + ) = InnerPrice(tieredPackageWithMinimum = tieredPackageWithMinimum) - when (modelType) { - "unit" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(unit = it, _json = json) - } ?: Price(_json = json) - } - "package" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(package_ = it, _json = json) - } ?: Price(_json = json) - } - "matrix" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(matrix = it, _json = json) - } ?: Price(_json = json) - } - "tiered" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(tiered = it, _json = json) - } ?: Price(_json = json) - } - "tiered_bps" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(tieredBps = it, _json = json) - } ?: Price(_json = json) - } - "bps" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(bps = it, _json = json) - } ?: Price(_json = json) - } - "bulk_bps" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(bulkBps = it, _json = json) - } ?: Price(_json = json) - } - "bulk" -> { - return tryDeserialize(node, jacksonTypeRef())?.let { - Price(bulk = it, _json = json) - } ?: Price(_json = json) - } - "threshold_total_amount" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(thresholdTotalAmount = it, _json = json) } - ?: Price(_json = json) - } - "tiered_package" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(tieredPackage = it, _json = json) } ?: Price(_json = json) - } - "tiered_with_minimum" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(tieredWithMinimum = it, _json = json) } - ?: Price(_json = json) - } - "unit_with_percent" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(unitWithPercent = it, _json = json) } - ?: Price(_json = json) - } - "package_with_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(packageWithAllocation = it, _json = json) } - ?: Price(_json = json) - } - "tiered_with_proration" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(tieredWithProration = it, _json = json) } - ?: Price(_json = json) - } - "unit_with_proration" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(unitWithProration = it, _json = json) } - ?: Price(_json = json) - } - "grouped_allocation" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(groupedAllocation = it, _json = json) } - ?: Price(_json = json) - } - "grouped_with_prorated_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(groupedWithProratedMinimum = it, _json = json) } - ?: Price(_json = json) - } - "grouped_with_metered_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(groupedWithMeteredMinimum = it, _json = json) } - ?: Price(_json = json) - } - "matrix_with_display_name" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(matrixWithDisplayName = it, _json = json) } - ?: Price(_json = json) - } - "bulk_with_proration" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(bulkWithProration = it, _json = json) } - ?: Price(_json = json) - } - "grouped_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(groupedTieredPackage = it, _json = json) } - ?: Price(_json = json) - } - "max_group_tiered_package" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(maxGroupTieredPackage = it, _json = json) } - ?: Price(_json = json) - } - "scalable_matrix_with_unit_pricing" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(scalableMatrixWithUnitPricing = it, _json = json) } - ?: Price(_json = json) - } - "scalable_matrix_with_tiered_pricing" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(scalableMatrixWithTieredPricing = it, _json = json) } - ?: Price(_json = json) - } - "cumulative_grouped_bulk" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(cumulativeGroupedBulk = it, _json = json) } - ?: Price(_json = json) - } - "tiered_package_with_minimum" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(tieredPackageWithMinimum = it, _json = json) } - ?: Price(_json = json) - } - "matrix_with_allocation" -> { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Price(matrixWithAllocation = it, _json = json) } - ?: Price(_json = json) - } - "grouped_tiered" -> { - return tryDeserialize(node, jacksonTypeRef()) - ?.let { Price(groupedTiered = it, _json = json) } ?: Price(_json = json) - } - } + @JvmStatic + fun ofMatrixWithAllocation(matrixWithAllocation: NewPlanMatrixWithAllocationPrice) = + InnerPrice(matrixWithAllocation = matrixWithAllocation) - return Price(_json = json) + @JvmStatic + fun ofGroupedTiered(groupedTiered: NewPlanGroupedTieredPrice) = + InnerPrice(groupedTiered = groupedTiered) } - } - internal class Serializer : BaseSerializer(Price::class) { + /** + * An interface that defines how to map each variant of [InnerPrice] to a value of type + * [T]. + */ + interface Visitor { - override fun serialize( - value: Price, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.unit != null -> generator.writeObject(value.unit) - value.package_ != null -> generator.writeObject(value.package_) - value.matrix != null -> generator.writeObject(value.matrix) - value.tiered != null -> generator.writeObject(value.tiered) - value.tieredBps != null -> generator.writeObject(value.tieredBps) - value.bps != null -> generator.writeObject(value.bps) - value.bulkBps != null -> generator.writeObject(value.bulkBps) - value.bulk != null -> generator.writeObject(value.bulk) - value.thresholdTotalAmount != null -> - generator.writeObject(value.thresholdTotalAmount) - value.tieredPackage != null -> generator.writeObject(value.tieredPackage) - value.tieredWithMinimum != null -> - generator.writeObject(value.tieredWithMinimum) - value.unitWithPercent != null -> generator.writeObject(value.unitWithPercent) - value.packageWithAllocation != null -> - generator.writeObject(value.packageWithAllocation) - value.tieredWithProration != null -> - generator.writeObject(value.tieredWithProration) - value.unitWithProration != null -> - generator.writeObject(value.unitWithProration) - value.groupedAllocation != null -> - generator.writeObject(value.groupedAllocation) - value.groupedWithProratedMinimum != null -> - generator.writeObject(value.groupedWithProratedMinimum) - value.groupedWithMeteredMinimum != null -> - generator.writeObject(value.groupedWithMeteredMinimum) - value.matrixWithDisplayName != null -> - generator.writeObject(value.matrixWithDisplayName) - value.bulkWithProration != null -> - generator.writeObject(value.bulkWithProration) - value.groupedTieredPackage != null -> - generator.writeObject(value.groupedTieredPackage) - value.maxGroupTieredPackage != null -> - generator.writeObject(value.maxGroupTieredPackage) - value.scalableMatrixWithUnitPricing != null -> - generator.writeObject(value.scalableMatrixWithUnitPricing) - value.scalableMatrixWithTieredPricing != null -> - generator.writeObject(value.scalableMatrixWithTieredPricing) - value.cumulativeGroupedBulk != null -> - generator.writeObject(value.cumulativeGroupedBulk) - value.tieredPackageWithMinimum != null -> - generator.writeObject(value.tieredPackageWithMinimum) - value.matrixWithAllocation != null -> - generator.writeObject(value.matrixWithAllocation) - value.groupedTiered != null -> generator.writeObject(value.groupedTiered) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Price") - } - } - } - } + fun visitUnit(unit: NewPlanUnitPrice): T - /** - * User-specified key/value pairs for the resource. Individual keys can be removed by setting - * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to - * `null`. - */ - class Metadata - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { + fun visitPackage(package_: NewPlanPackagePrice): T - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun visitMatrix(matrix: NewPlanMatrixPrice): T - fun toBuilder() = Builder().from(this) + fun visitTiered(tiered: NewPlanTieredPrice): T - companion object { + fun visitTieredBps(tieredBps: NewPlanTieredBpsPrice): T - /** Returns a mutable builder for constructing an instance of [Metadata]. */ - @JvmStatic fun builder() = Builder() - } + fun visitBps(bps: NewPlanBpsPrice): T - /** A builder for [Metadata]. */ - class Builder internal constructor() { + fun visitBulkBps(bulkBps: NewPlanBulkBpsPrice): T - private var additionalProperties: MutableMap = mutableMapOf() + fun visitBulk(bulk: NewPlanBulkPrice): T - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } + fun visitThresholdTotalAmount( + thresholdTotalAmount: NewPlanThresholdTotalAmountPrice + ): T - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun visitTieredPackage(tieredPackage: NewPlanTieredPackagePrice): T - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun visitTieredWithMinimum(tieredWithMinimum: NewPlanTieredWithMinimumPrice): T - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + fun visitUnitWithPercent(unitWithPercent: NewPlanUnitWithPercentPrice): T - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + fun visitPackageWithAllocation( + packageWithAllocation: NewPlanPackageWithAllocationPrice + ): T - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun visitTieredWithProration(tieredWithProration: NewPlanTierWithProrationPrice): T - /** + fun visitUnitWithProration(unitWithProration: NewPlanUnitWithProrationPrice): T + + fun visitGroupedAllocation(groupedAllocation: NewPlanGroupedAllocationPrice): T + + fun visitGroupedWithProratedMinimum( + groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice + ): T + + fun visitGroupedWithMeteredMinimum( + groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice + ): T + + fun visitMatrixWithDisplayName( + matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice + ): T + + fun visitBulkWithProration(bulkWithProration: NewPlanBulkWithProrationPrice): T + + fun visitGroupedTieredPackage( + groupedTieredPackage: NewPlanGroupedTieredPackagePrice + ): T + + fun visitMaxGroupTieredPackage( + maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice + ): T + + fun visitScalableMatrixWithUnitPricing( + scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice + ): T + + fun visitScalableMatrixWithTieredPricing( + scalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice + ): T + + fun visitCumulativeGroupedBulk( + cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice + ): T + + fun visitTieredPackageWithMinimum( + tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice + ): T + + fun visitMatrixWithAllocation( + matrixWithAllocation: NewPlanMatrixWithAllocationPrice + ): T + + fun visitGroupedTiered(groupedTiered: NewPlanGroupedTieredPrice): T + + /** + * Maps an unknown variant of [InnerPrice] to a value of type [T]. + * + * An instance of [InnerPrice] 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 InnerPrice: $json") + } + } + + internal class Deserializer : BaseDeserializer(InnerPrice::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): InnerPrice { + val json = JsonValue.fromJsonNode(node) + val modelType = + json.asObject().getOrNull()?.get("model_type")?.asString()?.getOrNull() + + when (modelType) { + "unit" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + InnerPrice(unit = it, _json = json) + } ?: InnerPrice(_json = json) + } + "package" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { InnerPrice(package_ = it, _json = json) } + ?: InnerPrice(_json = json) + } + "matrix" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + InnerPrice(matrix = it, _json = json) + } ?: InnerPrice(_json = json) + } + "tiered" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + InnerPrice(tiered = it, _json = json) + } ?: InnerPrice(_json = json) + } + "tiered_bps" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { InnerPrice(tieredBps = it, _json = json) } + ?: InnerPrice(_json = json) + } + "bps" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + InnerPrice(bps = it, _json = json) + } ?: InnerPrice(_json = json) + } + "bulk_bps" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { InnerPrice(bulkBps = it, _json = json) } + ?: InnerPrice(_json = json) + } + "bulk" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + InnerPrice(bulk = it, _json = json) + } ?: InnerPrice(_json = json) + } + "threshold_total_amount" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(thresholdTotalAmount = it, _json = json) } + ?: InnerPrice(_json = json) + } + "tiered_package" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { InnerPrice(tieredPackage = it, _json = json) } + ?: InnerPrice(_json = json) + } + "tiered_with_minimum" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(tieredWithMinimum = it, _json = json) } + ?: InnerPrice(_json = json) + } + "unit_with_percent" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(unitWithPercent = it, _json = json) } + ?: InnerPrice(_json = json) + } + "package_with_allocation" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(packageWithAllocation = it, _json = json) } + ?: InnerPrice(_json = json) + } + "tiered_with_proration" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(tieredWithProration = it, _json = json) } + ?: InnerPrice(_json = json) + } + "unit_with_proration" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(unitWithProration = it, _json = json) } + ?: InnerPrice(_json = json) + } + "grouped_allocation" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(groupedAllocation = it, _json = json) } + ?: InnerPrice(_json = json) + } + "grouped_with_prorated_minimum" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(groupedWithProratedMinimum = it, _json = json) } + ?: InnerPrice(_json = json) + } + "grouped_with_metered_minimum" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(groupedWithMeteredMinimum = it, _json = json) } + ?: InnerPrice(_json = json) + } + "matrix_with_display_name" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(matrixWithDisplayName = it, _json = json) } + ?: InnerPrice(_json = json) + } + "bulk_with_proration" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(bulkWithProration = it, _json = json) } + ?: InnerPrice(_json = json) + } + "grouped_tiered_package" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(groupedTieredPackage = it, _json = json) } + ?: InnerPrice(_json = json) + } + "max_group_tiered_package" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(maxGroupTieredPackage = it, _json = json) } + ?: InnerPrice(_json = json) + } + "scalable_matrix_with_unit_pricing" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + InnerPrice(scalableMatrixWithUnitPricing = it, _json = json) + } ?: InnerPrice(_json = json) + } + "scalable_matrix_with_tiered_pricing" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + InnerPrice(scalableMatrixWithTieredPricing = it, _json = json) + } ?: InnerPrice(_json = json) + } + "cumulative_grouped_bulk" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(cumulativeGroupedBulk = it, _json = json) } + ?: InnerPrice(_json = json) + } + "tiered_package_with_minimum" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(tieredPackageWithMinimum = it, _json = json) } + ?: InnerPrice(_json = json) + } + "matrix_with_allocation" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { InnerPrice(matrixWithAllocation = it, _json = json) } + ?: InnerPrice(_json = json) + } + "grouped_tiered" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { InnerPrice(groupedTiered = it, _json = json) } + ?: InnerPrice(_json = json) + } + } + + return InnerPrice(_json = json) + } + } + + internal class Serializer : BaseSerializer(InnerPrice::class) { + + override fun serialize( + value: InnerPrice, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.unit != null -> generator.writeObject(value.unit) + value.package_ != null -> generator.writeObject(value.package_) + value.matrix != null -> generator.writeObject(value.matrix) + value.tiered != null -> generator.writeObject(value.tiered) + value.tieredBps != null -> generator.writeObject(value.tieredBps) + value.bps != null -> generator.writeObject(value.bps) + value.bulkBps != null -> generator.writeObject(value.bulkBps) + value.bulk != null -> generator.writeObject(value.bulk) + value.thresholdTotalAmount != null -> + generator.writeObject(value.thresholdTotalAmount) + value.tieredPackage != null -> generator.writeObject(value.tieredPackage) + value.tieredWithMinimum != null -> + generator.writeObject(value.tieredWithMinimum) + value.unitWithPercent != null -> + generator.writeObject(value.unitWithPercent) + value.packageWithAllocation != null -> + generator.writeObject(value.packageWithAllocation) + value.tieredWithProration != null -> + generator.writeObject(value.tieredWithProration) + value.unitWithProration != null -> + generator.writeObject(value.unitWithProration) + value.groupedAllocation != null -> + generator.writeObject(value.groupedAllocation) + value.groupedWithProratedMinimum != null -> + generator.writeObject(value.groupedWithProratedMinimum) + value.groupedWithMeteredMinimum != null -> + generator.writeObject(value.groupedWithMeteredMinimum) + value.matrixWithDisplayName != null -> + generator.writeObject(value.matrixWithDisplayName) + value.bulkWithProration != null -> + generator.writeObject(value.bulkWithProration) + value.groupedTieredPackage != null -> + generator.writeObject(value.groupedTieredPackage) + value.maxGroupTieredPackage != null -> + generator.writeObject(value.maxGroupTieredPackage) + value.scalableMatrixWithUnitPricing != null -> + generator.writeObject(value.scalableMatrixWithUnitPricing) + value.scalableMatrixWithTieredPricing != null -> + generator.writeObject(value.scalableMatrixWithTieredPricing) + value.cumulativeGroupedBulk != null -> + generator.writeObject(value.cumulativeGroupedBulk) + value.tieredPackageWithMinimum != null -> + generator.writeObject(value.tieredPackageWithMinimum) + value.matrixWithAllocation != null -> + generator.writeObject(value.matrixWithAllocation) + value.groupedTiered != null -> generator.writeObject(value.groupedTiered) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid InnerPrice") + } + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Price && allocationPrice == other.allocationPrice && planPhaseOrder == other.planPhaseOrder && price == other.price && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(allocationPrice, planPhaseOrder, price, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Price{allocationPrice=$allocationPrice, planPhaseOrder=$planPhaseOrder, price=$price, additionalProperties=$additionalProperties}" + } + + class Adjustment + private constructor( + private val adjustment: JsonField, + private val planPhaseOrder: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("adjustment") + @ExcludeMissing + adjustment: JsonField = JsonMissing.of(), + @JsonProperty("plan_phase_order") + @ExcludeMissing + planPhaseOrder: JsonField = JsonMissing.of(), + ) : this(adjustment, planPhaseOrder, mutableMapOf()) + + /** + * The definition of a new adjustment to create and add to the plan. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun adjustment(): InnerAdjustment = adjustment.getRequired("adjustment") + + /** + * The phase to add this adjustment to. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun planPhaseOrder(): Optional = planPhaseOrder.getOptional("plan_phase_order") + + /** + * Returns the raw JSON value of [adjustment]. + * + * Unlike [adjustment], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("adjustment") + @ExcludeMissing + fun _adjustment(): JsonField = adjustment + + /** + * Returns the raw JSON value of [planPhaseOrder]. + * + * Unlike [planPhaseOrder], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun _planPhaseOrder(): JsonField = planPhaseOrder + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Adjustment]. + * + * The following fields are required: + * ```java + * .adjustment() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Adjustment]. */ + class Builder internal constructor() { + + private var adjustment: JsonField? = null + private var planPhaseOrder: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(adjustment: Adjustment) = apply { + this.adjustment = adjustment.adjustment + planPhaseOrder = adjustment.planPhaseOrder + additionalProperties = adjustment.additionalProperties.toMutableMap() + } + + /** The definition of a new adjustment to create and add to the plan. */ + fun adjustment(adjustment: InnerAdjustment) = adjustment(JsonField.of(adjustment)) + + /** + * Sets [Builder.adjustment] to an arbitrary JSON value. + * + * You should usually call [Builder.adjustment] with a well-typed [InnerAdjustment] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun adjustment(adjustment: JsonField) = apply { + this.adjustment = adjustment + } + + /** + * Alias for calling [adjustment] with + * `InnerAdjustment.ofPercentageDiscount(percentageDiscount)`. + */ + fun adjustment(percentageDiscount: NewPercentageDiscount) = + adjustment(InnerAdjustment.ofPercentageDiscount(percentageDiscount)) + + /** + * Alias for calling [adjustment] with the following: + * ```java + * NewPercentageDiscount.builder() + * .adjustmentType(NewPercentageDiscount.AdjustmentType.PERCENTAGE_DISCOUNT) + * .percentageDiscount(percentageDiscount) + * .build() + * ``` + */ + fun percentageDiscountAdjustment(percentageDiscount: Double) = + adjustment( + NewPercentageDiscount.builder() + .adjustmentType(NewPercentageDiscount.AdjustmentType.PERCENTAGE_DISCOUNT) + .percentageDiscount(percentageDiscount) + .build() + ) + + /** + * Alias for calling [adjustment] with `InnerAdjustment.ofUsageDiscount(usageDiscount)`. + */ + fun adjustment(usageDiscount: NewUsageDiscount) = + adjustment(InnerAdjustment.ofUsageDiscount(usageDiscount)) + + /** + * Alias for calling [adjustment] with the following: + * ```java + * NewUsageDiscount.builder() + * .adjustmentType(NewUsageDiscount.AdjustmentType.USAGE_DISCOUNT) + * .usageDiscount(usageDiscount) + * .build() + * ``` + */ + fun usageDiscountAdjustment(usageDiscount: Double) = + adjustment( + NewUsageDiscount.builder() + .adjustmentType(NewUsageDiscount.AdjustmentType.USAGE_DISCOUNT) + .usageDiscount(usageDiscount) + .build() + ) + + /** + * Alias for calling [adjustment] with + * `InnerAdjustment.ofAmountDiscount(amountDiscount)`. + */ + fun adjustment(amountDiscount: NewAmountDiscount) = + adjustment(InnerAdjustment.ofAmountDiscount(amountDiscount)) + + /** + * Alias for calling [adjustment] with the following: + * ```java + * NewAmountDiscount.builder() + * .adjustmentType(NewAmountDiscount.AdjustmentType.AMOUNT_DISCOUNT) + * .amountDiscount(amountDiscount) + * .build() + * ``` + */ + fun amountDiscountAdjustment(amountDiscount: String) = + adjustment( + NewAmountDiscount.builder() + .adjustmentType(NewAmountDiscount.AdjustmentType.AMOUNT_DISCOUNT) + .amountDiscount(amountDiscount) + .build() + ) + + /** Alias for calling [adjustment] with `InnerAdjustment.ofMinimum(minimum)`. */ + fun adjustment(minimum: NewMinimum) = adjustment(InnerAdjustment.ofMinimum(minimum)) + + /** Alias for calling [adjustment] with `InnerAdjustment.ofMaximum(maximum)`. */ + fun adjustment(maximum: NewMaximum) = adjustment(InnerAdjustment.ofMaximum(maximum)) + + /** + * Alias for calling [adjustment] with the following: + * ```java + * NewMaximum.builder() + * .adjustmentType(NewMaximum.AdjustmentType.MAXIMUM) + * .maximumAmount(maximumAmount) + * .build() + * ``` + */ + fun maximumAdjustment(maximumAmount: String) = + adjustment( + NewMaximum.builder() + .adjustmentType(NewMaximum.AdjustmentType.MAXIMUM) + .maximumAmount(maximumAmount) + .build() + ) + + /** The phase to add this adjustment to. */ + fun planPhaseOrder(planPhaseOrder: Long?) = + planPhaseOrder(JsonField.ofNullable(planPhaseOrder)) + + /** + * Alias for [Builder.planPhaseOrder]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(planPhaseOrder as Long?) + + /** Alias for calling [Builder.planPhaseOrder] with `planPhaseOrder.orElse(null)`. */ + fun planPhaseOrder(planPhaseOrder: Optional) = + planPhaseOrder(planPhaseOrder.getOrNull()) + + /** + * Sets [Builder.planPhaseOrder] to an arbitrary JSON value. + * + * You should usually call [Builder.planPhaseOrder] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Adjustment]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .adjustment() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Adjustment = + Adjustment( + checkRequired("adjustment", adjustment), + planPhaseOrder, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Adjustment = apply { + if (validated) { + return@apply + } + + adjustment().validate() + planPhaseOrder() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OrbInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (adjustment.asKnown().getOrNull()?.validity() ?: 0) + + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + + /** The definition of a new adjustment to create and add to the plan. */ + @JsonDeserialize(using = InnerAdjustment.Deserializer::class) + @JsonSerialize(using = InnerAdjustment.Serializer::class) + class InnerAdjustment + private constructor( + private val percentageDiscount: NewPercentageDiscount? = null, + private val usageDiscount: NewUsageDiscount? = null, + private val amountDiscount: NewAmountDiscount? = null, + private val minimum: NewMinimum? = null, + private val maximum: NewMaximum? = null, + private val _json: JsonValue? = null, + ) { + + fun percentageDiscount(): Optional = + Optional.ofNullable(percentageDiscount) + + fun usageDiscount(): Optional = Optional.ofNullable(usageDiscount) + + fun amountDiscount(): Optional = Optional.ofNullable(amountDiscount) + + fun minimum(): Optional = Optional.ofNullable(minimum) + + fun maximum(): Optional = Optional.ofNullable(maximum) + + fun isPercentageDiscount(): Boolean = percentageDiscount != null + + fun isUsageDiscount(): Boolean = usageDiscount != null + + fun isAmountDiscount(): Boolean = amountDiscount != null + + fun isMinimum(): Boolean = minimum != null + + fun isMaximum(): Boolean = maximum != null + + fun asPercentageDiscount(): NewPercentageDiscount = + percentageDiscount.getOrThrow("percentageDiscount") + + fun asUsageDiscount(): NewUsageDiscount = usageDiscount.getOrThrow("usageDiscount") + + fun asAmountDiscount(): NewAmountDiscount = amountDiscount.getOrThrow("amountDiscount") + + fun asMinimum(): NewMinimum = minimum.getOrThrow("minimum") + + fun asMaximum(): NewMaximum = maximum.getOrThrow("maximum") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + percentageDiscount != null -> + visitor.visitPercentageDiscount(percentageDiscount) + usageDiscount != null -> visitor.visitUsageDiscount(usageDiscount) + amountDiscount != null -> visitor.visitAmountDiscount(amountDiscount) + minimum != null -> visitor.visitMinimum(minimum) + maximum != null -> visitor.visitMaximum(maximum) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): InnerAdjustment = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitPercentageDiscount( + percentageDiscount: NewPercentageDiscount + ) { + percentageDiscount.validate() + } + + override fun visitUsageDiscount(usageDiscount: NewUsageDiscount) { + usageDiscount.validate() + } + + override fun visitAmountDiscount(amountDiscount: NewAmountDiscount) { + amountDiscount.validate() + } + + override fun visitMinimum(minimum: NewMinimum) { + minimum.validate() + } + + override fun visitMaximum(maximum: NewMaximum) { + maximum.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OrbInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitPercentageDiscount( + percentageDiscount: NewPercentageDiscount + ) = percentageDiscount.validity() + + override fun visitUsageDiscount(usageDiscount: NewUsageDiscount) = + usageDiscount.validity() + + override fun visitAmountDiscount(amountDiscount: NewAmountDiscount) = + amountDiscount.validity() + + override fun visitMinimum(minimum: NewMinimum) = minimum.validity() + + override fun visitMaximum(maximum: NewMaximum) = maximum.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerAdjustment && percentageDiscount == other.percentageDiscount && usageDiscount == other.usageDiscount && amountDiscount == other.amountDiscount && minimum == other.minimum && maximum == other.maximum /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(percentageDiscount, usageDiscount, amountDiscount, minimum, maximum) /* spotless:on */ + + override fun toString(): String = + when { + percentageDiscount != null -> + "InnerAdjustment{percentageDiscount=$percentageDiscount}" + usageDiscount != null -> "InnerAdjustment{usageDiscount=$usageDiscount}" + amountDiscount != null -> "InnerAdjustment{amountDiscount=$amountDiscount}" + minimum != null -> "InnerAdjustment{minimum=$minimum}" + maximum != null -> "InnerAdjustment{maximum=$maximum}" + _json != null -> "InnerAdjustment{_unknown=$_json}" + else -> throw IllegalStateException("Invalid InnerAdjustment") + } + + companion object { + + @JvmStatic + fun ofPercentageDiscount(percentageDiscount: NewPercentageDiscount) = + InnerAdjustment(percentageDiscount = percentageDiscount) + + @JvmStatic + fun ofUsageDiscount(usageDiscount: NewUsageDiscount) = + InnerAdjustment(usageDiscount = usageDiscount) + + @JvmStatic + fun ofAmountDiscount(amountDiscount: NewAmountDiscount) = + InnerAdjustment(amountDiscount = amountDiscount) + + @JvmStatic fun ofMinimum(minimum: NewMinimum) = InnerAdjustment(minimum = minimum) + + @JvmStatic fun ofMaximum(maximum: NewMaximum) = InnerAdjustment(maximum = maximum) + } + + /** + * An interface that defines how to map each variant of [InnerAdjustment] to a value of + * type [T]. + */ + interface Visitor { + + fun visitPercentageDiscount(percentageDiscount: NewPercentageDiscount): T + + fun visitUsageDiscount(usageDiscount: NewUsageDiscount): T + + fun visitAmountDiscount(amountDiscount: NewAmountDiscount): T + + fun visitMinimum(minimum: NewMinimum): T + + fun visitMaximum(maximum: NewMaximum): T + + /** + * Maps an unknown variant of [InnerAdjustment] to a value of type [T]. + * + * An instance of [InnerAdjustment] 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 InnerAdjustment: $json") + } + } + + internal class Deserializer : + BaseDeserializer(InnerAdjustment::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): InnerAdjustment { + val json = JsonValue.fromJsonNode(node) + val adjustmentType = + json.asObject().getOrNull()?.get("adjustment_type")?.asString()?.getOrNull() + + when (adjustmentType) { + "percentage_discount" -> { + return tryDeserialize(node, jacksonTypeRef()) + ?.let { InnerAdjustment(percentageDiscount = it, _json = json) } + ?: InnerAdjustment(_json = json) + } + "usage_discount" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + InnerAdjustment(usageDiscount = it, _json = json) + } ?: InnerAdjustment(_json = json) + } + "amount_discount" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + InnerAdjustment(amountDiscount = it, _json = json) + } ?: InnerAdjustment(_json = json) + } + "minimum" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + InnerAdjustment(minimum = it, _json = json) + } ?: InnerAdjustment(_json = json) + } + "maximum" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + InnerAdjustment(maximum = it, _json = json) + } ?: InnerAdjustment(_json = json) + } + } + + return InnerAdjustment(_json = json) + } + } + + internal class Serializer : BaseSerializer(InnerAdjustment::class) { + + override fun serialize( + value: InnerAdjustment, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.percentageDiscount != null -> + generator.writeObject(value.percentageDiscount) + value.usageDiscount != null -> generator.writeObject(value.usageDiscount) + value.amountDiscount != null -> generator.writeObject(value.amountDiscount) + value.minimum != null -> generator.writeObject(value.minimum) + value.maximum != null -> generator.writeObject(value.maximum) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid InnerAdjustment") + } + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Adjustment && adjustment == other.adjustment && planPhaseOrder == other.planPhaseOrder && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(adjustment, planPhaseOrder, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Adjustment{adjustment=$adjustment, planPhaseOrder=$planPhaseOrder, 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`. + */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Metadata]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** * Returns an immutable instance of [Metadata]. * * Further updates to this [Builder] will not mutate the returned instance. @@ -2450,6 +3389,463 @@ private constructor( override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } + class PlanPhase + private constructor( + private val order: JsonField, + private val alignBillingWithPhaseStartDate: JsonField, + private val duration: JsonField, + private val durationUnit: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("order") @ExcludeMissing order: JsonField = JsonMissing.of(), + @JsonProperty("align_billing_with_phase_start_date") + @ExcludeMissing + alignBillingWithPhaseStartDate: JsonField = JsonMissing.of(), + @JsonProperty("duration") @ExcludeMissing duration: JsonField = JsonMissing.of(), + @JsonProperty("duration_unit") + @ExcludeMissing + durationUnit: JsonField = JsonMissing.of(), + ) : this(order, alignBillingWithPhaseStartDate, duration, durationUnit, mutableMapOf()) + + /** + * Determines the ordering of the phase in a plan's lifecycle. 1 = first phase. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun order(): Long = order.getRequired("order") + + /** + * Align billing cycle day with phase start date. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun alignBillingWithPhaseStartDate(): Optional = + alignBillingWithPhaseStartDate.getOptional("align_billing_with_phase_start_date") + + /** + * How many terms of length `duration_unit` this phase is active for. If null, this phase is + * evergreen and active indefinitely + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun duration(): Optional = duration.getOptional("duration") + + /** + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun durationUnit(): Optional = durationUnit.getOptional("duration_unit") + + /** + * Returns the raw JSON value of [order]. + * + * Unlike [order], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("order") @ExcludeMissing fun _order(): JsonField = order + + /** + * Returns the raw JSON value of [alignBillingWithPhaseStartDate]. + * + * Unlike [alignBillingWithPhaseStartDate], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("align_billing_with_phase_start_date") + @ExcludeMissing + fun _alignBillingWithPhaseStartDate(): JsonField = alignBillingWithPhaseStartDate + + /** + * Returns the raw JSON value of [duration]. + * + * Unlike [duration], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("duration") @ExcludeMissing fun _duration(): JsonField = duration + + /** + * Returns the raw JSON value of [durationUnit]. + * + * Unlike [durationUnit], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit(): JsonField = durationUnit + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [PlanPhase]. + * + * The following fields are required: + * ```java + * .order() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PlanPhase]. */ + class Builder internal constructor() { + + private var order: JsonField? = null + private var alignBillingWithPhaseStartDate: JsonField = JsonMissing.of() + private var duration: JsonField = JsonMissing.of() + private var durationUnit: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(planPhase: PlanPhase) = apply { + order = planPhase.order + alignBillingWithPhaseStartDate = planPhase.alignBillingWithPhaseStartDate + duration = planPhase.duration + durationUnit = planPhase.durationUnit + additionalProperties = planPhase.additionalProperties.toMutableMap() + } + + /** Determines the ordering of the phase in a plan's lifecycle. 1 = first phase. */ + fun order(order: Long) = order(JsonField.of(order)) + + /** + * Sets [Builder.order] to an arbitrary JSON value. + * + * You should usually call [Builder.order] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun order(order: JsonField) = apply { this.order = order } + + /** Align billing cycle day with phase start date. */ + fun alignBillingWithPhaseStartDate(alignBillingWithPhaseStartDate: Boolean?) = + alignBillingWithPhaseStartDate(JsonField.ofNullable(alignBillingWithPhaseStartDate)) + + /** + * Alias for [Builder.alignBillingWithPhaseStartDate]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun alignBillingWithPhaseStartDate(alignBillingWithPhaseStartDate: Boolean) = + alignBillingWithPhaseStartDate(alignBillingWithPhaseStartDate as Boolean?) + + /** + * Alias for calling [Builder.alignBillingWithPhaseStartDate] with + * `alignBillingWithPhaseStartDate.orElse(null)`. + */ + fun alignBillingWithPhaseStartDate(alignBillingWithPhaseStartDate: Optional) = + alignBillingWithPhaseStartDate(alignBillingWithPhaseStartDate.getOrNull()) + + /** + * Sets [Builder.alignBillingWithPhaseStartDate] to an arbitrary JSON value. + * + * You should usually call [Builder.alignBillingWithPhaseStartDate] with a well-typed + * [Boolean] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun alignBillingWithPhaseStartDate(alignBillingWithPhaseStartDate: JsonField) = + apply { + this.alignBillingWithPhaseStartDate = alignBillingWithPhaseStartDate + } + + /** + * How many terms of length `duration_unit` this phase is active for. If null, this + * phase is evergreen and active indefinitely + */ + fun duration(duration: Long?) = duration(JsonField.ofNullable(duration)) + + /** + * Alias for [Builder.duration]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun duration(duration: Long) = duration(duration as Long?) + + /** Alias for calling [Builder.duration] with `duration.orElse(null)`. */ + fun duration(duration: Optional) = duration(duration.getOrNull()) + + /** + * Sets [Builder.duration] to an arbitrary JSON value. + * + * You should usually call [Builder.duration] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun duration(duration: JsonField) = apply { this.duration = duration } + + fun durationUnit(durationUnit: DurationUnit?) = + durationUnit(JsonField.ofNullable(durationUnit)) + + /** Alias for calling [Builder.durationUnit] with `durationUnit.orElse(null)`. */ + fun durationUnit(durationUnit: Optional) = + durationUnit(durationUnit.getOrNull()) + + /** + * Sets [Builder.durationUnit] to an arbitrary JSON value. + * + * You should usually call [Builder.durationUnit] with a well-typed [DurationUnit] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [PlanPhase]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .order() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): PlanPhase = + PlanPhase( + checkRequired("order", order), + alignBillingWithPhaseStartDate, + duration, + durationUnit, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): PlanPhase = apply { + if (validated) { + return@apply + } + + order() + alignBillingWithPhaseStartDate() + duration() + durationUnit().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OrbInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (order.asKnown().isPresent) 1 else 0) + + (if (alignBillingWithPhaseStartDate.asKnown().isPresent) 1 else 0) + + (if (duration.asKnown().isPresent) 1 else 0) + + (durationUnit.asKnown().getOrNull()?.validity() ?: 0) + + 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 DAILY = of("daily") + + @JvmField val MONTHLY = of("monthly") + + @JvmField val QUARTERLY = of("quarterly") + + @JvmField val SEMI_ANNUAL = of("semi_annual") + + @JvmField val ANNUAL = of("annual") + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + /** An enum containing [DurationUnit]'s known values. */ + enum class Known { + DAILY, + MONTHLY, + QUARTERLY, + SEMI_ANNUAL, + ANNUAL, + } + + /** + * 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 { + DAILY, + MONTHLY, + QUARTERLY, + SEMI_ANNUAL, + ANNUAL, + /** + * 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) { + DAILY -> Value.DAILY + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + SEMI_ANNUAL -> Value.SEMI_ANNUAL + ANNUAL -> Value.ANNUAL + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OrbInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + DAILY -> Known.DAILY + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + SEMI_ANNUAL -> Known.SEMI_ANNUAL + ANNUAL -> Known.ANNUAL + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OrbInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { OrbInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): DurationUnit = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OrbInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + 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 PlanPhase && order == other.order && alignBillingWithPhaseStartDate == other.alignBillingWithPhaseStartDate && duration == other.duration && durationUnit == other.durationUnit && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(order, alignBillingWithPhaseStartDate, duration, durationUnit, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "PlanPhase{order=$order, alignBillingWithPhaseStartDate=$alignBillingWithPhaseStartDate, duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + /** * The status of the plan to create (either active or draft). If not specified, this defaults to * active. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseAmountDiscountAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseAmountDiscountAdjustment.kt index 477fdd73..4ecb20d4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseAmountDiscountAdjustment.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseAmountDiscountAdjustment.kt @@ -30,6 +30,7 @@ private constructor( private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, private val reason: JsonField, + private val replacesAdjustmentId: JsonField, private val additionalProperties: MutableMap, ) { @@ -55,6 +56,9 @@ private constructor( @ExcludeMissing planPhaseOrder: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + replacesAdjustmentId: JsonField = JsonMissing.of(), ) : this( id, adjustmentType, @@ -64,6 +68,7 @@ private constructor( isInvoiceLevel, planPhaseOrder, reason, + replacesAdjustmentId, mutableMapOf(), ) @@ -130,6 +135,16 @@ private constructor( */ fun reason(): Optional = reason.getOptional("reason") + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun replacesAdjustmentId(): Optional = + replacesAdjustmentId.getOptional("replaces_adjustment_id") + /** * Returns the raw JSON value of [id]. * @@ -200,6 +215,16 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [replacesAdjustmentId]. + * + * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -228,6 +253,7 @@ private constructor( * .isInvoiceLevel() * .planPhaseOrder() * .reason() + * .replacesAdjustmentId() * ``` */ @JvmStatic fun builder() = Builder() @@ -244,6 +270,7 @@ private constructor( private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null private var reason: JsonField? = null + private var replacesAdjustmentId: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -258,6 +285,7 @@ private constructor( isInvoiceLevel = planPhaseAmountDiscountAdjustment.isInvoiceLevel planPhaseOrder = planPhaseAmountDiscountAdjustment.planPhaseOrder reason = planPhaseAmountDiscountAdjustment.reason + replacesAdjustmentId = planPhaseAmountDiscountAdjustment.replacesAdjustmentId additionalProperties = planPhaseAmountDiscountAdjustment.additionalProperties.toMutableMap() } @@ -416,6 +444,31 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + */ + fun replacesAdjustmentId(replacesAdjustmentId: String?) = + replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId)) + + /** + * Alias for calling [Builder.replacesAdjustmentId] with + * `replacesAdjustmentId.orElse(null)`. + */ + fun replacesAdjustmentId(replacesAdjustmentId: Optional) = + replacesAdjustmentId(replacesAdjustmentId.getOrNull()) + + /** + * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply { + this.replacesAdjustmentId = replacesAdjustmentId + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -450,6 +503,7 @@ private constructor( * .isInvoiceLevel() * .planPhaseOrder() * .reason() + * .replacesAdjustmentId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -464,6 +518,7 @@ private constructor( checkRequired("isInvoiceLevel", isInvoiceLevel), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("reason", reason), + checkRequired("replacesAdjustmentId", replacesAdjustmentId), additionalProperties.toMutableMap(), ) } @@ -483,6 +538,7 @@ private constructor( isInvoiceLevel() planPhaseOrder() reason() + replacesAdjustmentId() validated = true } @@ -508,7 +564,8 @@ private constructor( (filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + - (if (reason.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + + (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0) class AdjustmentType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -637,15 +694,15 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PlanPhaseAmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, filters, isInvoiceLevel, planPhaseOrder, reason, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amountDiscount, appliesToPriceIds, filters, isInvoiceLevel, planPhaseOrder, reason, replacesAdjustmentId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PlanPhaseAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseMaximumAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseMaximumAdjustment.kt index 719fe732..66612377 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseMaximumAdjustment.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseMaximumAdjustment.kt @@ -30,6 +30,7 @@ private constructor( private val maximumAmount: JsonField, private val planPhaseOrder: JsonField, private val reason: JsonField, + private val replacesAdjustmentId: JsonField, private val additionalProperties: MutableMap, ) { @@ -55,6 +56,9 @@ private constructor( @ExcludeMissing planPhaseOrder: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + replacesAdjustmentId: JsonField = JsonMissing.of(), ) : this( id, adjustmentType, @@ -64,6 +68,7 @@ private constructor( maximumAmount, planPhaseOrder, reason, + replacesAdjustmentId, mutableMapOf(), ) @@ -130,6 +135,16 @@ private constructor( */ fun reason(): Optional = reason.getOptional("reason") + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun replacesAdjustmentId(): Optional = + replacesAdjustmentId.getOptional("replaces_adjustment_id") + /** * Returns the raw JSON value of [id]. * @@ -200,6 +215,16 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [replacesAdjustmentId]. + * + * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -227,6 +252,7 @@ private constructor( * .maximumAmount() * .planPhaseOrder() * .reason() + * .replacesAdjustmentId() * ``` */ @JvmStatic fun builder() = Builder() @@ -243,6 +269,7 @@ private constructor( private var maximumAmount: JsonField? = null private var planPhaseOrder: JsonField? = null private var reason: JsonField? = null + private var replacesAdjustmentId: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -256,6 +283,7 @@ private constructor( maximumAmount = planPhaseMaximumAdjustment.maximumAmount planPhaseOrder = planPhaseMaximumAdjustment.planPhaseOrder reason = planPhaseMaximumAdjustment.reason + replacesAdjustmentId = planPhaseMaximumAdjustment.replacesAdjustmentId additionalProperties = planPhaseMaximumAdjustment.additionalProperties.toMutableMap() } @@ -413,6 +441,31 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + */ + fun replacesAdjustmentId(replacesAdjustmentId: String?) = + replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId)) + + /** + * Alias for calling [Builder.replacesAdjustmentId] with + * `replacesAdjustmentId.orElse(null)`. + */ + fun replacesAdjustmentId(replacesAdjustmentId: Optional) = + replacesAdjustmentId(replacesAdjustmentId.getOrNull()) + + /** + * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply { + this.replacesAdjustmentId = replacesAdjustmentId + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -447,6 +500,7 @@ private constructor( * .maximumAmount() * .planPhaseOrder() * .reason() + * .replacesAdjustmentId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -461,6 +515,7 @@ private constructor( checkRequired("maximumAmount", maximumAmount), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("reason", reason), + checkRequired("replacesAdjustmentId", replacesAdjustmentId), additionalProperties.toMutableMap(), ) } @@ -480,6 +535,7 @@ private constructor( maximumAmount() planPhaseOrder() reason() + replacesAdjustmentId() validated = true } @@ -505,7 +561,8 @@ private constructor( (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (maximumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + - (if (reason.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + + (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0) class AdjustmentType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -634,15 +691,15 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PlanPhaseMaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, filters, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, filters, isInvoiceLevel, maximumAmount, planPhaseOrder, reason, replacesAdjustmentId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PlanPhaseMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseMinimumAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseMinimumAdjustment.kt index 324703b5..916a2b0a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseMinimumAdjustment.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseMinimumAdjustment.kt @@ -31,6 +31,7 @@ private constructor( private val minimumAmount: JsonField, private val planPhaseOrder: JsonField, private val reason: JsonField, + private val replacesAdjustmentId: JsonField, private val additionalProperties: MutableMap, ) { @@ -57,6 +58,9 @@ private constructor( @ExcludeMissing planPhaseOrder: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + replacesAdjustmentId: JsonField = JsonMissing.of(), ) : this( id, adjustmentType, @@ -67,6 +71,7 @@ private constructor( minimumAmount, planPhaseOrder, reason, + replacesAdjustmentId, mutableMapOf(), ) @@ -141,6 +146,16 @@ private constructor( */ fun reason(): Optional = reason.getOptional("reason") + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun replacesAdjustmentId(): Optional = + replacesAdjustmentId.getOptional("replaces_adjustment_id") + /** * Returns the raw JSON value of [id]. * @@ -218,6 +233,16 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [replacesAdjustmentId]. + * + * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -246,6 +271,7 @@ private constructor( * .minimumAmount() * .planPhaseOrder() * .reason() + * .replacesAdjustmentId() * ``` */ @JvmStatic fun builder() = Builder() @@ -263,6 +289,7 @@ private constructor( private var minimumAmount: JsonField? = null private var planPhaseOrder: JsonField? = null private var reason: JsonField? = null + private var replacesAdjustmentId: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -277,6 +304,7 @@ private constructor( minimumAmount = planPhaseMinimumAdjustment.minimumAmount planPhaseOrder = planPhaseMinimumAdjustment.planPhaseOrder reason = planPhaseMinimumAdjustment.reason + replacesAdjustmentId = planPhaseMinimumAdjustment.replacesAdjustmentId additionalProperties = planPhaseMinimumAdjustment.additionalProperties.toMutableMap() } @@ -445,6 +473,31 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + */ + fun replacesAdjustmentId(replacesAdjustmentId: String?) = + replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId)) + + /** + * Alias for calling [Builder.replacesAdjustmentId] with + * `replacesAdjustmentId.orElse(null)`. + */ + fun replacesAdjustmentId(replacesAdjustmentId: Optional) = + replacesAdjustmentId(replacesAdjustmentId.getOrNull()) + + /** + * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply { + this.replacesAdjustmentId = replacesAdjustmentId + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -480,6 +533,7 @@ private constructor( * .minimumAmount() * .planPhaseOrder() * .reason() + * .replacesAdjustmentId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -495,6 +549,7 @@ private constructor( checkRequired("minimumAmount", minimumAmount), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("reason", reason), + checkRequired("replacesAdjustmentId", replacesAdjustmentId), additionalProperties.toMutableMap(), ) } @@ -515,6 +570,7 @@ private constructor( minimumAmount() planPhaseOrder() reason() + replacesAdjustmentId() validated = true } @@ -541,7 +597,8 @@ private constructor( (if (itemId.asKnown().isPresent) 1 else 0) + (if (minimumAmount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + - (if (reason.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + + (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0) class AdjustmentType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -670,15 +727,15 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseMinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PlanPhaseMinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, filters, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, filters, isInvoiceLevel, itemId, minimumAmount, planPhaseOrder, reason, replacesAdjustmentId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PlanPhaseMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, planPhaseOrder=$planPhaseOrder, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhasePercentageDiscountAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhasePercentageDiscountAdjustment.kt index 1243cc03..42007ae2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhasePercentageDiscountAdjustment.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhasePercentageDiscountAdjustment.kt @@ -30,6 +30,7 @@ private constructor( private val percentageDiscount: JsonField, private val planPhaseOrder: JsonField, private val reason: JsonField, + private val replacesAdjustmentId: JsonField, private val additionalProperties: MutableMap, ) { @@ -55,6 +56,9 @@ private constructor( @ExcludeMissing planPhaseOrder: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + replacesAdjustmentId: JsonField = JsonMissing.of(), ) : this( id, adjustmentType, @@ -64,6 +68,7 @@ private constructor( percentageDiscount, planPhaseOrder, reason, + replacesAdjustmentId, mutableMapOf(), ) @@ -130,6 +135,16 @@ private constructor( */ fun reason(): Optional = reason.getOptional("reason") + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun replacesAdjustmentId(): Optional = + replacesAdjustmentId.getOptional("replaces_adjustment_id") + /** * Returns the raw JSON value of [id]. * @@ -201,6 +216,16 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [replacesAdjustmentId]. + * + * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -229,6 +254,7 @@ private constructor( * .percentageDiscount() * .planPhaseOrder() * .reason() + * .replacesAdjustmentId() * ``` */ @JvmStatic fun builder() = Builder() @@ -245,6 +271,7 @@ private constructor( private var percentageDiscount: JsonField? = null private var planPhaseOrder: JsonField? = null private var reason: JsonField? = null + private var replacesAdjustmentId: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -260,6 +287,7 @@ private constructor( percentageDiscount = planPhasePercentageDiscountAdjustment.percentageDiscount planPhaseOrder = planPhasePercentageDiscountAdjustment.planPhaseOrder reason = planPhasePercentageDiscountAdjustment.reason + replacesAdjustmentId = planPhasePercentageDiscountAdjustment.replacesAdjustmentId additionalProperties = planPhasePercentageDiscountAdjustment.additionalProperties.toMutableMap() } @@ -419,6 +447,31 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + */ + fun replacesAdjustmentId(replacesAdjustmentId: String?) = + replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId)) + + /** + * Alias for calling [Builder.replacesAdjustmentId] with + * `replacesAdjustmentId.orElse(null)`. + */ + fun replacesAdjustmentId(replacesAdjustmentId: Optional) = + replacesAdjustmentId(replacesAdjustmentId.getOrNull()) + + /** + * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply { + this.replacesAdjustmentId = replacesAdjustmentId + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -453,6 +506,7 @@ private constructor( * .percentageDiscount() * .planPhaseOrder() * .reason() + * .replacesAdjustmentId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -467,6 +521,7 @@ private constructor( checkRequired("percentageDiscount", percentageDiscount), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("reason", reason), + checkRequired("replacesAdjustmentId", replacesAdjustmentId), additionalProperties.toMutableMap(), ) } @@ -486,6 +541,7 @@ private constructor( percentageDiscount() planPhaseOrder() reason() + replacesAdjustmentId() validated = true } @@ -511,7 +567,8 @@ private constructor( (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (percentageDiscount.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + - (if (reason.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + + (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0) class AdjustmentType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -640,15 +697,15 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PlanPhasePercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && planPhaseOrder == other.planPhaseOrder && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, filters, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, filters, isInvoiceLevel, percentageDiscount, planPhaseOrder, reason, replacesAdjustmentId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, additionalProperties=$additionalProperties}" + "PlanPhasePercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, planPhaseOrder=$planPhaseOrder, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseUsageDiscountAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseUsageDiscountAdjustment.kt index 0876d95b..a057996d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseUsageDiscountAdjustment.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanPhaseUsageDiscountAdjustment.kt @@ -29,6 +29,7 @@ private constructor( private val isInvoiceLevel: JsonField, private val planPhaseOrder: JsonField, private val reason: JsonField, + private val replacesAdjustmentId: JsonField, private val usageDiscount: JsonField, private val additionalProperties: MutableMap, ) { @@ -52,6 +53,9 @@ private constructor( @ExcludeMissing planPhaseOrder: JsonField = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + replacesAdjustmentId: JsonField = JsonMissing.of(), @JsonProperty("usage_discount") @ExcludeMissing usageDiscount: JsonField = JsonMissing.of(), @@ -63,6 +67,7 @@ private constructor( isInvoiceLevel, planPhaseOrder, reason, + replacesAdjustmentId, usageDiscount, mutableMapOf(), ) @@ -121,6 +126,16 @@ private constructor( */ fun reason(): Optional = reason.getOptional("reason") + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun replacesAdjustmentId(): Optional = + replacesAdjustmentId.getOptional("replaces_adjustment_id") + /** * The number of usage units by which to discount the price this adjustment applies to in a * given billing period. @@ -191,6 +206,16 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [replacesAdjustmentId]. + * + * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_adjustment_id") + @ExcludeMissing + fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId + /** * Returns the raw JSON value of [usageDiscount]. * @@ -227,6 +252,7 @@ private constructor( * .isInvoiceLevel() * .planPhaseOrder() * .reason() + * .replacesAdjustmentId() * .usageDiscount() * ``` */ @@ -243,6 +269,7 @@ private constructor( private var isInvoiceLevel: JsonField? = null private var planPhaseOrder: JsonField? = null private var reason: JsonField? = null + private var replacesAdjustmentId: JsonField? = null private var usageDiscount: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -257,6 +284,7 @@ private constructor( isInvoiceLevel = planPhaseUsageDiscountAdjustment.isInvoiceLevel planPhaseOrder = planPhaseUsageDiscountAdjustment.planPhaseOrder reason = planPhaseUsageDiscountAdjustment.reason + replacesAdjustmentId = planPhaseUsageDiscountAdjustment.replacesAdjustmentId usageDiscount = planPhaseUsageDiscountAdjustment.usageDiscount additionalProperties = planPhaseUsageDiscountAdjustment.additionalProperties.toMutableMap() @@ -399,6 +427,31 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** + * The adjustment id this adjustment replaces. This adjustment will take the place of the + * replaced adjustment in plan version migrations. + */ + fun replacesAdjustmentId(replacesAdjustmentId: String?) = + replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId)) + + /** + * Alias for calling [Builder.replacesAdjustmentId] with + * `replacesAdjustmentId.orElse(null)`. + */ + fun replacesAdjustmentId(replacesAdjustmentId: Optional) = + replacesAdjustmentId(replacesAdjustmentId.getOrNull()) + + /** + * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply { + this.replacesAdjustmentId = replacesAdjustmentId + } + /** * The number of usage units by which to discount the price this adjustment applies to in a * given billing period. @@ -449,6 +502,7 @@ private constructor( * .isInvoiceLevel() * .planPhaseOrder() * .reason() + * .replacesAdjustmentId() * .usageDiscount() * ``` * @@ -463,6 +517,7 @@ private constructor( checkRequired("isInvoiceLevel", isInvoiceLevel), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("reason", reason), + checkRequired("replacesAdjustmentId", replacesAdjustmentId), checkRequired("usageDiscount", usageDiscount), additionalProperties.toMutableMap(), ) @@ -482,6 +537,7 @@ private constructor( isInvoiceLevel() planPhaseOrder() reason() + replacesAdjustmentId() usageDiscount() validated = true } @@ -508,6 +564,7 @@ private constructor( (if (isInvoiceLevel.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + + (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0) + (if (usageDiscount.asKnown().isPresent) 1 else 0) class AdjustmentType @JsonCreator private constructor(private val value: JsonField) : @@ -637,15 +694,15 @@ private constructor( return true } - return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PlanPhaseUsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, filters, isInvoiceLevel, planPhaseOrder, reason, usageDiscount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, appliesToPriceIds, filters, isInvoiceLevel, planPhaseOrder, reason, replacesAdjustmentId, usageDiscount, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" + "PlanPhaseUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Price.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Price.kt index 6a228ec1..9556b497 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 @@ -1025,6 +1025,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val unitConfig: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, @@ -1087,6 +1088,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("unit_config") @ExcludeMissing unitConfig: JsonField = JsonMissing.of(), @@ -1118,6 +1122,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, unitConfig, dimensionalPriceConfiguration, mutableMapOf(), @@ -1279,6 +1284,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -1496,6 +1510,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [unitConfig]. * @@ -1557,6 +1581,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .unitConfig() * ``` */ @@ -1589,6 +1614,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var unitConfig: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() @@ -1619,6 +1645,7 @@ private constructor( name = unit.name planPhaseOrder = unit.planPhaseOrder priceType = unit.priceType + replacesPriceId = unit.replacesPriceId unitConfig = unit.unitConfig dimensionalPriceConfiguration = unit.dimensionalPriceConfiguration additionalProperties = unit.additionalProperties.toMutableMap() @@ -2138,6 +2165,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun unitConfig(unitConfig: UnitConfig) = unitConfig(JsonField.of(unitConfig)) /** @@ -2222,6 +2271,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .unitConfig() * ``` * @@ -2252,6 +2302,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), checkRequired("unitConfig", unitConfig), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), @@ -2292,6 +2343,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() unitConfig().validate() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true @@ -2336,6 +2388,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (unitConfig.asKnown().getOrNull()?.validity() ?: 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) @@ -2916,17 +2969,17 @@ private constructor( return true } - return /* spotless:off */ other is Unit && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && unitConfig == other.unitConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Unit && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && unitConfig == other.unitConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, unitConfig, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, unitConfig, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Unit{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, unitConfig=$unitConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "Unit{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, unitConfig=$unitConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class Package @@ -2955,6 +3008,7 @@ private constructor( private val packageConfig: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -3019,6 +3073,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -3048,6 +3105,7 @@ private constructor( packageConfig, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -3214,6 +3272,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -3435,6 +3502,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -3488,6 +3565,7 @@ private constructor( * .packageConfig() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -3520,6 +3598,7 @@ private constructor( private var packageConfig: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -3550,6 +3629,7 @@ private constructor( packageConfig = package_.packageConfig planPhaseOrder = package_.planPhaseOrder priceType = package_.priceType + replacesPriceId = package_.replacesPriceId dimensionalPriceConfiguration = package_.dimensionalPriceConfiguration additionalProperties = package_.additionalProperties.toMutableMap() } @@ -4082,6 +4162,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -4154,6 +4256,7 @@ private constructor( * .packageConfig() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -4184,6 +4287,7 @@ private constructor( checkRequired("packageConfig", packageConfig), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -4224,6 +4328,7 @@ private constructor( packageConfig().validate() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -4268,6 +4373,7 @@ private constructor( (packageConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -4847,17 +4953,17 @@ private constructor( return true } - return /* spotless:off */ other is Package && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Package && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && packageConfig == other.packageConfig && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, packageConfig, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, packageConfig, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Package{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, packageConfig=$packageConfig, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "Package{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, packageConfig=$packageConfig, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class Matrix @@ -4886,6 +4992,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -4950,6 +5057,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -4979,6 +5089,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -5145,6 +5256,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -5366,6 +5486,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -5419,6 +5549,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -5451,6 +5582,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -5481,6 +5613,7 @@ private constructor( name = matrix.name planPhaseOrder = matrix.planPhaseOrder priceType = matrix.priceType + replacesPriceId = matrix.replacesPriceId dimensionalPriceConfiguration = matrix.dimensionalPriceConfiguration additionalProperties = matrix.additionalProperties.toMutableMap() } @@ -6012,6 +6145,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -6084,6 +6239,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -6114,6 +6270,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -6154,6 +6311,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -6198,6 +6356,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -6777,17 +6936,17 @@ private constructor( return true } - return /* spotless:off */ other is Matrix && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixConfig == other.matrixConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Matrix && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixConfig == other.matrixConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Matrix{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixConfig=$matrixConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "Matrix{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixConfig=$matrixConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class Tiered @@ -6815,6 +6974,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val tieredConfig: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, @@ -6877,6 +7037,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("tiered_config") @ExcludeMissing tieredConfig: JsonField = JsonMissing.of(), @@ -6908,6 +7071,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, tieredConfig, dimensionalPriceConfiguration, mutableMapOf(), @@ -7069,6 +7233,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -7286,6 +7459,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [tieredConfig]. * @@ -7348,6 +7531,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .tieredConfig() * ``` */ @@ -7380,6 +7564,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var tieredConfig: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() @@ -7410,6 +7595,7 @@ private constructor( name = tiered.name planPhaseOrder = tiered.planPhaseOrder priceType = tiered.priceType + replacesPriceId = tiered.replacesPriceId tieredConfig = tiered.tieredConfig dimensionalPriceConfiguration = tiered.dimensionalPriceConfiguration additionalProperties = tiered.additionalProperties.toMutableMap() @@ -7929,6 +8115,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun tieredConfig(tieredConfig: TieredConfig) = tieredConfig(JsonField.of(tieredConfig)) /** @@ -8013,6 +8221,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .tieredConfig() * ``` * @@ -8043,6 +8252,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), checkRequired("tieredConfig", tieredConfig), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), @@ -8083,6 +8293,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() tieredConfig().validate() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true @@ -8127,6 +8338,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (tieredConfig.asKnown().getOrNull()?.validity() ?: 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) @@ -8707,17 +8919,17 @@ private constructor( return true } - return /* spotless:off */ other is Tiered && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredConfig == other.tieredConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tiered && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && tieredConfig == other.tieredConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredConfig, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, tieredConfig, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tiered{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredConfig=$tieredConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "Tiered{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, tieredConfig=$tieredConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class TieredBps @@ -8745,6 +8957,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val tieredBpsConfig: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, @@ -8807,6 +9020,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("tiered_bps_config") @ExcludeMissing tieredBpsConfig: JsonField = JsonMissing.of(), @@ -8838,6 +9054,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, tieredBpsConfig, dimensionalPriceConfiguration, mutableMapOf(), @@ -8999,6 +9216,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -9216,6 +9442,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [tieredBpsConfig]. * @@ -9278,6 +9514,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .tieredBpsConfig() * ``` */ @@ -9310,6 +9547,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var tieredBpsConfig: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() @@ -9340,6 +9578,7 @@ private constructor( name = tieredBps.name planPhaseOrder = tieredBps.planPhaseOrder priceType = tieredBps.priceType + replacesPriceId = tieredBps.replacesPriceId tieredBpsConfig = tieredBps.tieredBpsConfig dimensionalPriceConfiguration = tieredBps.dimensionalPriceConfiguration additionalProperties = tieredBps.additionalProperties.toMutableMap() @@ -9859,6 +10098,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = tieredBpsConfig(JsonField.of(tieredBpsConfig)) @@ -9944,6 +10205,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .tieredBpsConfig() * ``` * @@ -9974,6 +10236,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), checkRequired("tieredBpsConfig", tieredBpsConfig), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), @@ -10014,6 +10277,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() tieredBpsConfig().validate() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true @@ -10058,6 +10322,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (tieredBpsConfig.asKnown().getOrNull()?.validity() ?: 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) @@ -10638,17 +10903,17 @@ private constructor( return true } - return /* spotless:off */ other is TieredBps && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredBpsConfig == other.tieredBpsConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredBps && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && tieredBpsConfig == other.tieredBpsConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredBpsConfig, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, tieredBpsConfig, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TieredBps{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredBpsConfig=$tieredBpsConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "TieredBps{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, tieredBpsConfig=$tieredBpsConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class Bps @@ -10677,6 +10942,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -10741,6 +11007,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -10770,6 +11039,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -10936,6 +11206,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -11156,6 +11435,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -11209,6 +11498,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -11241,6 +11531,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -11271,6 +11562,7 @@ private constructor( name = bps.name planPhaseOrder = bps.planPhaseOrder priceType = bps.priceType + replacesPriceId = bps.replacesPriceId dimensionalPriceConfiguration = bps.dimensionalPriceConfiguration additionalProperties = bps.additionalProperties.toMutableMap() } @@ -11800,6 +12092,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -11872,6 +12186,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -11902,6 +12217,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -11942,6 +12258,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -11986,6 +12303,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -12565,17 +12883,17 @@ private constructor( return true } - return /* spotless:off */ other is Bps && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bpsConfig == other.bpsConfig && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Bps && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bpsConfig == other.bpsConfig && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bpsConfig, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bpsConfig, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Bps{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bpsConfig=$bpsConfig, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "Bps{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bpsConfig=$bpsConfig, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class BulkBps @@ -12604,6 +12922,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -12668,6 +12987,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -12697,6 +13019,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -12863,6 +13186,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -13084,6 +13416,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -13137,6 +13479,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -13169,6 +13512,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -13199,6 +13543,7 @@ private constructor( name = bulkBps.name planPhaseOrder = bulkBps.planPhaseOrder priceType = bulkBps.priceType + replacesPriceId = bulkBps.replacesPriceId dimensionalPriceConfiguration = bulkBps.dimensionalPriceConfiguration additionalProperties = bulkBps.additionalProperties.toMutableMap() } @@ -13731,6 +14076,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -13803,6 +14170,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -13833,6 +14201,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -13873,6 +14242,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -13917,6 +14287,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -14496,17 +14867,17 @@ private constructor( return true } - return /* spotless:off */ other is BulkBps && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkBps && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bulkBpsConfig, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bulkBpsConfig, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BulkBps{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "BulkBps{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class Bulk @@ -14535,6 +14906,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -14599,6 +14971,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -14628,6 +15003,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -14794,6 +15170,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -15014,6 +15399,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -15067,6 +15462,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -15099,6 +15495,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -15129,6 +15526,7 @@ private constructor( name = bulk.name planPhaseOrder = bulk.planPhaseOrder priceType = bulk.priceType + replacesPriceId = bulk.replacesPriceId dimensionalPriceConfiguration = bulk.dimensionalPriceConfiguration additionalProperties = bulk.additionalProperties.toMutableMap() } @@ -15660,6 +16058,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -15732,6 +16152,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -15762,6 +16183,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -15802,6 +16224,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -15846,6 +16269,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -16425,17 +16849,17 @@ private constructor( return true } - return /* spotless:off */ other is Bulk && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bulkConfig == other.bulkConfig && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Bulk && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bulkConfig == other.bulkConfig && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bulkConfig, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bulkConfig, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Bulk{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bulkConfig=$bulkConfig, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "Bulk{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bulkConfig=$bulkConfig, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class ThresholdTotalAmount @@ -16463,6 +16887,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val thresholdTotalAmountConfig: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, @@ -16525,6 +16950,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("threshold_total_amount_config") @ExcludeMissing thresholdTotalAmountConfig: JsonField = JsonMissing.of(), @@ -16556,6 +16984,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, thresholdTotalAmountConfig, dimensionalPriceConfiguration, mutableMapOf(), @@ -16717,6 +17146,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -16935,6 +17373,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [thresholdTotalAmountConfig]. * @@ -16998,6 +17446,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .thresholdTotalAmountConfig() * ``` */ @@ -17030,6 +17479,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var thresholdTotalAmountConfig: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() @@ -17060,6 +17510,7 @@ private constructor( name = thresholdTotalAmount.name planPhaseOrder = thresholdTotalAmount.planPhaseOrder priceType = thresholdTotalAmount.priceType + replacesPriceId = thresholdTotalAmount.replacesPriceId thresholdTotalAmountConfig = thresholdTotalAmount.thresholdTotalAmountConfig dimensionalPriceConfiguration = thresholdTotalAmount.dimensionalPriceConfiguration additionalProperties = thresholdTotalAmount.additionalProperties.toMutableMap() @@ -17579,6 +18030,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun thresholdTotalAmountConfig(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = thresholdTotalAmountConfig(JsonField.of(thresholdTotalAmountConfig)) @@ -17664,6 +18137,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .thresholdTotalAmountConfig() * ``` * @@ -17694,6 +18168,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), checkRequired("thresholdTotalAmountConfig", thresholdTotalAmountConfig), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), @@ -17734,6 +18209,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() thresholdTotalAmountConfig().validate() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true @@ -17778,6 +18254,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (thresholdTotalAmountConfig.asKnown().getOrNull()?.validity() ?: 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) @@ -18468,17 +18945,17 @@ private constructor( return true } - return /* spotless:off */ other is ThresholdTotalAmount && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ThresholdTotalAmount && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, thresholdTotalAmountConfig, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, thresholdTotalAmountConfig, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ThresholdTotalAmount{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "ThresholdTotalAmount{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class TieredPackage @@ -18506,6 +18983,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val tieredPackageConfig: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, @@ -18568,6 +19046,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("tiered_package_config") @ExcludeMissing tieredPackageConfig: JsonField = JsonMissing.of(), @@ -18599,6 +19080,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, tieredPackageConfig, dimensionalPriceConfiguration, mutableMapOf(), @@ -18760,6 +19242,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -18978,6 +19469,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [tieredPackageConfig]. * @@ -19040,6 +19541,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .tieredPackageConfig() * ``` */ @@ -19072,6 +19574,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var tieredPackageConfig: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() @@ -19102,6 +19605,7 @@ private constructor( name = tieredPackage.name planPhaseOrder = tieredPackage.planPhaseOrder priceType = tieredPackage.priceType + replacesPriceId = tieredPackage.replacesPriceId tieredPackageConfig = tieredPackage.tieredPackageConfig dimensionalPriceConfiguration = tieredPackage.dimensionalPriceConfiguration additionalProperties = tieredPackage.additionalProperties.toMutableMap() @@ -19621,6 +20125,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = tieredPackageConfig(JsonField.of(tieredPackageConfig)) @@ -19706,6 +20232,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .tieredPackageConfig() * ``` * @@ -19736,6 +20263,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), checkRequired("tieredPackageConfig", tieredPackageConfig), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), @@ -19776,6 +20304,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() tieredPackageConfig().validate() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true @@ -19820,6 +20349,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (tieredPackageConfig.asKnown().getOrNull()?.validity() ?: 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) @@ -20508,17 +21038,17 @@ private constructor( return true } - return /* spotless:off */ other is TieredPackage && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredPackageConfig == other.tieredPackageConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredPackage && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && tieredPackageConfig == other.tieredPackageConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredPackageConfig, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, tieredPackageConfig, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TieredPackage{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredPackageConfig=$tieredPackageConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "TieredPackage{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, tieredPackageConfig=$tieredPackageConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class GroupedTiered @@ -20547,6 +21077,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -20611,6 +21142,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -20640,6 +21174,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -20807,6 +21342,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -21028,6 +21572,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -21081,6 +21635,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -21113,6 +21668,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -21143,6 +21699,7 @@ private constructor( name = groupedTiered.name planPhaseOrder = groupedTiered.planPhaseOrder priceType = groupedTiered.priceType + replacesPriceId = groupedTiered.replacesPriceId dimensionalPriceConfiguration = groupedTiered.dimensionalPriceConfiguration additionalProperties = groupedTiered.additionalProperties.toMutableMap() } @@ -21675,6 +22232,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -21747,6 +22326,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -21777,6 +22357,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -21817,6 +22398,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -21861,6 +22443,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -22548,17 +23131,17 @@ private constructor( return true } - return /* spotless:off */ other is GroupedTiered && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedTieredConfig == other.groupedTieredConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTiered && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedTieredConfig == other.groupedTieredConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedTieredConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedTieredConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedTiered{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedTieredConfig=$groupedTieredConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "GroupedTiered{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedTieredConfig=$groupedTieredConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class TieredWithMinimum @@ -22586,6 +23169,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val tieredWithMinimumConfig: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, @@ -22648,6 +23232,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("tiered_with_minimum_config") @ExcludeMissing tieredWithMinimumConfig: JsonField = JsonMissing.of(), @@ -22679,6 +23266,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, tieredWithMinimumConfig, dimensionalPriceConfiguration, mutableMapOf(), @@ -22840,6 +23428,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -23058,6 +23655,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [tieredWithMinimumConfig]. * @@ -23120,6 +23727,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .tieredWithMinimumConfig() * ``` */ @@ -23152,6 +23760,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var tieredWithMinimumConfig: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() @@ -23182,6 +23791,7 @@ private constructor( name = tieredWithMinimum.name planPhaseOrder = tieredWithMinimum.planPhaseOrder priceType = tieredWithMinimum.priceType + replacesPriceId = tieredWithMinimum.replacesPriceId tieredWithMinimumConfig = tieredWithMinimum.tieredWithMinimumConfig dimensionalPriceConfiguration = tieredWithMinimum.dimensionalPriceConfiguration additionalProperties = tieredWithMinimum.additionalProperties.toMutableMap() @@ -23701,6 +24311,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = tieredWithMinimumConfig(JsonField.of(tieredWithMinimumConfig)) @@ -23786,6 +24418,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .tieredWithMinimumConfig() * ``` * @@ -23816,6 +24449,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), checkRequired("tieredWithMinimumConfig", tieredWithMinimumConfig), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), @@ -23856,6 +24490,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() tieredWithMinimumConfig().validate() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true @@ -23900,6 +24535,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (tieredWithMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) @@ -24590,17 +25226,17 @@ private constructor( return true } - return /* spotless:off */ other is TieredWithMinimum && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredWithMinimumConfig == other.tieredWithMinimumConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredWithMinimum && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && tieredWithMinimumConfig == other.tieredWithMinimumConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredWithMinimumConfig, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, tieredWithMinimumConfig, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TieredWithMinimum{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredWithMinimumConfig=$tieredWithMinimumConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "TieredWithMinimum{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, tieredWithMinimumConfig=$tieredWithMinimumConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class TieredPackageWithMinimum @@ -24628,6 +25264,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val tieredPackageWithMinimumConfig: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, @@ -24690,6 +25327,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("tiered_package_with_minimum_config") @ExcludeMissing tieredPackageWithMinimumConfig: JsonField = @@ -24722,6 +25362,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, tieredPackageWithMinimumConfig, dimensionalPriceConfiguration, mutableMapOf(), @@ -24883,6 +25524,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -25101,6 +25751,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [tieredPackageWithMinimumConfig]. * @@ -25164,6 +25824,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .tieredPackageWithMinimumConfig() * ``` */ @@ -25196,6 +25857,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var tieredPackageWithMinimumConfig: JsonField? = null private var dimensionalPriceConfiguration: JsonField = @@ -25227,6 +25889,7 @@ private constructor( name = tieredPackageWithMinimum.name planPhaseOrder = tieredPackageWithMinimum.planPhaseOrder priceType = tieredPackageWithMinimum.priceType + replacesPriceId = tieredPackageWithMinimum.replacesPriceId tieredPackageWithMinimumConfig = tieredPackageWithMinimum.tieredPackageWithMinimumConfig dimensionalPriceConfiguration = @@ -25748,6 +26411,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun tieredPackageWithMinimumConfig( tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig ) = tieredPackageWithMinimumConfig(JsonField.of(tieredPackageWithMinimumConfig)) @@ -25834,6 +26519,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .tieredPackageWithMinimumConfig() * ``` * @@ -25864,6 +26550,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), checkRequired("tieredPackageWithMinimumConfig", tieredPackageWithMinimumConfig), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), @@ -25904,6 +26591,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() tieredPackageWithMinimumConfig().validate() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true @@ -25950,6 +26638,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (tieredPackageWithMinimumConfig.asKnown().getOrNull()?.validity() ?: 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) @@ -26641,17 +27330,17 @@ private constructor( return true } - return /* spotless:off */ other is TieredPackageWithMinimum && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredPackageWithMinimum && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredPackageWithMinimumConfig, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, tieredPackageWithMinimumConfig, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TieredPackageWithMinimum{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "TieredPackageWithMinimum{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class PackageWithAllocation @@ -26680,6 +27369,7 @@ private constructor( private val packageWithAllocationConfig: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -26744,6 +27434,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -26773,6 +27466,7 @@ private constructor( packageWithAllocationConfig, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -26940,6 +27634,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -27162,6 +27865,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -27215,6 +27928,7 @@ private constructor( * .packageWithAllocationConfig() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -27247,6 +27961,7 @@ private constructor( private var packageWithAllocationConfig: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -27277,6 +27992,7 @@ private constructor( packageWithAllocationConfig = packageWithAllocation.packageWithAllocationConfig planPhaseOrder = packageWithAllocation.planPhaseOrder priceType = packageWithAllocation.priceType + replacesPriceId = packageWithAllocation.replacesPriceId dimensionalPriceConfiguration = packageWithAllocation.dimensionalPriceConfiguration additionalProperties = packageWithAllocation.additionalProperties.toMutableMap() } @@ -27810,6 +28526,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -27882,6 +28620,7 @@ private constructor( * .packageWithAllocationConfig() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -27912,6 +28651,7 @@ private constructor( checkRequired("packageWithAllocationConfig", packageWithAllocationConfig), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -27952,6 +28692,7 @@ private constructor( packageWithAllocationConfig().validate() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -27996,6 +28737,7 @@ private constructor( (packageWithAllocationConfig.asKnown().getOrNull()?.validity() ?: 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -28686,17 +29428,17 @@ private constructor( return true } - return /* spotless:off */ other is PackageWithAllocation && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PackageWithAllocation && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && packageWithAllocationConfig == other.packageWithAllocationConfig && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, packageWithAllocationConfig, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, packageWithAllocationConfig, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PackageWithAllocation{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "PackageWithAllocation{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, packageWithAllocationConfig=$packageWithAllocationConfig, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class UnitWithPercent @@ -28724,6 +29466,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val unitWithPercentConfig: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, @@ -28786,6 +29529,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("unit_with_percent_config") @ExcludeMissing unitWithPercentConfig: JsonField = JsonMissing.of(), @@ -28817,6 +29563,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, unitWithPercentConfig, dimensionalPriceConfiguration, mutableMapOf(), @@ -28978,6 +29725,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -29196,6 +29952,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [unitWithPercentConfig]. * @@ -29258,6 +30024,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .unitWithPercentConfig() * ``` */ @@ -29290,6 +30057,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var unitWithPercentConfig: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() @@ -29320,6 +30088,7 @@ private constructor( name = unitWithPercent.name planPhaseOrder = unitWithPercent.planPhaseOrder priceType = unitWithPercent.priceType + replacesPriceId = unitWithPercent.replacesPriceId unitWithPercentConfig = unitWithPercent.unitWithPercentConfig dimensionalPriceConfiguration = unitWithPercent.dimensionalPriceConfiguration additionalProperties = unitWithPercent.additionalProperties.toMutableMap() @@ -29839,6 +30608,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = unitWithPercentConfig(JsonField.of(unitWithPercentConfig)) @@ -29925,6 +30716,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .unitWithPercentConfig() * ``` * @@ -29955,6 +30747,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), checkRequired("unitWithPercentConfig", unitWithPercentConfig), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), @@ -29995,6 +30788,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() unitWithPercentConfig().validate() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true @@ -30039,6 +30833,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (unitWithPercentConfig.asKnown().getOrNull()?.validity() ?: 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) @@ -30728,17 +31523,17 @@ private constructor( return true } - return /* spotless:off */ other is UnitWithPercent && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && unitWithPercentConfig == other.unitWithPercentConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitWithPercent && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && unitWithPercentConfig == other.unitWithPercentConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, unitWithPercentConfig, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, unitWithPercentConfig, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UnitWithPercent{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, unitWithPercentConfig=$unitWithPercentConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "UnitWithPercent{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, unitWithPercentConfig=$unitWithPercentConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class MatrixWithAllocation @@ -30767,6 +31562,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -30831,6 +31627,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -30860,6 +31659,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -31027,6 +31827,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -31249,6 +32058,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -31302,6 +32121,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -31334,6 +32154,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -31364,6 +32185,7 @@ private constructor( name = matrixWithAllocation.name planPhaseOrder = matrixWithAllocation.planPhaseOrder priceType = matrixWithAllocation.priceType + replacesPriceId = matrixWithAllocation.replacesPriceId dimensionalPriceConfiguration = matrixWithAllocation.dimensionalPriceConfiguration additionalProperties = matrixWithAllocation.additionalProperties.toMutableMap() } @@ -31896,6 +32718,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -31968,6 +32812,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -31998,6 +32843,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -32038,6 +32884,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -32082,6 +32929,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -32661,17 +33509,17 @@ private constructor( return true } - return /* spotless:off */ other is MatrixWithAllocation && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixWithAllocationConfig == other.matrixWithAllocationConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithAllocation && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixWithAllocationConfig == other.matrixWithAllocationConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixWithAllocationConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixWithAllocationConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixWithAllocation{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixWithAllocationConfig=$matrixWithAllocationConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "MatrixWithAllocation{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixWithAllocationConfig=$matrixWithAllocationConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class TieredWithProration @@ -32699,6 +33547,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val tieredWithProrationConfig: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, @@ -32761,6 +33610,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("tiered_with_proration_config") @ExcludeMissing tieredWithProrationConfig: JsonField = JsonMissing.of(), @@ -32792,6 +33644,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, tieredWithProrationConfig, dimensionalPriceConfiguration, mutableMapOf(), @@ -32953,6 +33806,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -33171,6 +34033,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [tieredWithProrationConfig]. * @@ -33234,6 +34106,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .tieredWithProrationConfig() * ``` */ @@ -33266,6 +34139,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var tieredWithProrationConfig: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() @@ -33296,6 +34170,7 @@ private constructor( name = tieredWithProration.name planPhaseOrder = tieredWithProration.planPhaseOrder priceType = tieredWithProration.priceType + replacesPriceId = tieredWithProration.replacesPriceId tieredWithProrationConfig = tieredWithProration.tieredWithProrationConfig dimensionalPriceConfiguration = tieredWithProration.dimensionalPriceConfiguration additionalProperties = tieredWithProration.additionalProperties.toMutableMap() @@ -33815,6 +34690,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun tieredWithProrationConfig(tieredWithProrationConfig: TieredWithProrationConfig) = tieredWithProrationConfig(JsonField.of(tieredWithProrationConfig)) @@ -33900,6 +34797,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .tieredWithProrationConfig() * ``` * @@ -33930,6 +34828,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), checkRequired("tieredWithProrationConfig", tieredWithProrationConfig), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), @@ -33970,6 +34869,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() tieredWithProrationConfig().validate() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true @@ -34014,6 +34914,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (tieredWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) @@ -34704,17 +35605,17 @@ private constructor( return true } - return /* spotless:off */ other is TieredWithProration && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && tieredWithProrationConfig == other.tieredWithProrationConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredWithProration && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && tieredWithProrationConfig == other.tieredWithProrationConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, tieredWithProrationConfig, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, tieredWithProrationConfig, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "TieredWithProration{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, tieredWithProrationConfig=$tieredWithProrationConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "TieredWithProration{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, tieredWithProrationConfig=$tieredWithProrationConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class UnitWithProration @@ -34742,6 +35643,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val unitWithProrationConfig: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, @@ -34804,6 +35706,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("unit_with_proration_config") @ExcludeMissing unitWithProrationConfig: JsonField = JsonMissing.of(), @@ -34835,6 +35740,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, unitWithProrationConfig, dimensionalPriceConfiguration, mutableMapOf(), @@ -34996,6 +35902,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -35214,6 +36129,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [unitWithProrationConfig]. * @@ -35276,6 +36201,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .unitWithProrationConfig() * ``` */ @@ -35308,6 +36234,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var unitWithProrationConfig: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() @@ -35338,6 +36265,7 @@ private constructor( name = unitWithProration.name planPhaseOrder = unitWithProration.planPhaseOrder priceType = unitWithProration.priceType + replacesPriceId = unitWithProration.replacesPriceId unitWithProrationConfig = unitWithProration.unitWithProrationConfig dimensionalPriceConfiguration = unitWithProration.dimensionalPriceConfiguration additionalProperties = unitWithProration.additionalProperties.toMutableMap() @@ -35857,6 +36785,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = unitWithProrationConfig(JsonField.of(unitWithProrationConfig)) @@ -35942,6 +36892,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .unitWithProrationConfig() * ``` * @@ -35972,6 +36923,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), checkRequired("unitWithProrationConfig", unitWithProrationConfig), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), @@ -36012,6 +36964,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() unitWithProrationConfig().validate() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true @@ -36056,6 +37009,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (unitWithProrationConfig.asKnown().getOrNull()?.validity() ?: 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) @@ -36746,17 +37700,17 @@ private constructor( return true } - return /* spotless:off */ other is UnitWithProration && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && unitWithProrationConfig == other.unitWithProrationConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitWithProration && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && unitWithProrationConfig == other.unitWithProrationConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, unitWithProrationConfig, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, unitWithProrationConfig, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UnitWithProration{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, unitWithProrationConfig=$unitWithProrationConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "UnitWithProration{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, unitWithProrationConfig=$unitWithProrationConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class GroupedAllocation @@ -36785,6 +37739,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -36849,6 +37804,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -36878,6 +37836,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -37045,6 +38004,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -37266,6 +38234,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -37319,6 +38297,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -37351,6 +38330,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -37381,6 +38361,7 @@ private constructor( name = groupedAllocation.name planPhaseOrder = groupedAllocation.planPhaseOrder priceType = groupedAllocation.priceType + replacesPriceId = groupedAllocation.replacesPriceId dimensionalPriceConfiguration = groupedAllocation.dimensionalPriceConfiguration additionalProperties = groupedAllocation.additionalProperties.toMutableMap() } @@ -37913,6 +38894,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -37985,6 +38988,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -38015,6 +39019,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -38055,6 +39060,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -38099,6 +39105,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -38788,17 +39795,17 @@ private constructor( return true } - return /* spotless:off */ other is GroupedAllocation && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedAllocationConfig == other.groupedAllocationConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedAllocation && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedAllocationConfig == other.groupedAllocationConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedAllocationConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedAllocationConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedAllocation{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedAllocationConfig=$groupedAllocationConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "GroupedAllocation{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedAllocationConfig=$groupedAllocationConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class GroupedWithProratedMinimum @@ -38827,6 +39834,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -38892,6 +39900,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -38921,6 +39932,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -39088,6 +40100,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -39310,6 +40331,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -39364,6 +40395,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -39398,6 +40430,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -39429,6 +40462,7 @@ private constructor( name = groupedWithProratedMinimum.name planPhaseOrder = groupedWithProratedMinimum.planPhaseOrder priceType = groupedWithProratedMinimum.priceType + replacesPriceId = groupedWithProratedMinimum.replacesPriceId dimensionalPriceConfiguration = groupedWithProratedMinimum.dimensionalPriceConfiguration additionalProperties = @@ -39964,6 +40998,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -40036,6 +41092,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -40069,6 +41126,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -40109,6 +41167,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -40155,6 +41214,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -40846,17 +41906,17 @@ private constructor( return true } - return /* spotless:off */ other is GroupedWithProratedMinimum && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithProratedMinimum && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedWithProratedMinimumConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedWithProratedMinimumConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedWithProratedMinimum{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "GroupedWithProratedMinimum{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class GroupedWithMeteredMinimum @@ -40885,6 +41945,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -40950,6 +42011,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -40979,6 +42043,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -41146,6 +42211,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -41368,6 +42442,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -41422,6 +42506,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -41456,6 +42541,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -41487,6 +42573,7 @@ private constructor( name = groupedWithMeteredMinimum.name planPhaseOrder = groupedWithMeteredMinimum.planPhaseOrder priceType = groupedWithMeteredMinimum.priceType + replacesPriceId = groupedWithMeteredMinimum.replacesPriceId dimensionalPriceConfiguration = groupedWithMeteredMinimum.dimensionalPriceConfiguration additionalProperties = groupedWithMeteredMinimum.additionalProperties.toMutableMap() @@ -42021,6 +43108,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -42093,6 +43202,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -42126,6 +43236,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -42166,6 +43277,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -42212,6 +43324,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -42903,17 +44016,17 @@ private constructor( return true } - return /* spotless:off */ other is GroupedWithMeteredMinimum && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithMeteredMinimum && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedWithMeteredMinimumConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedWithMeteredMinimumConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedWithMeteredMinimum{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "GroupedWithMeteredMinimum{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class MatrixWithDisplayName @@ -42942,6 +44055,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -43006,6 +44120,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -43035,6 +44152,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -43202,6 +44320,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -43424,6 +44551,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -43477,6 +44614,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -43509,6 +44647,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -43539,6 +44678,7 @@ private constructor( name = matrixWithDisplayName.name planPhaseOrder = matrixWithDisplayName.planPhaseOrder priceType = matrixWithDisplayName.priceType + replacesPriceId = matrixWithDisplayName.replacesPriceId dimensionalPriceConfiguration = matrixWithDisplayName.dimensionalPriceConfiguration additionalProperties = matrixWithDisplayName.additionalProperties.toMutableMap() } @@ -44072,6 +45212,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -44144,6 +45306,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -44174,6 +45337,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -44214,6 +45378,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -44258,6 +45423,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -44948,17 +46114,17 @@ private constructor( return true } - return /* spotless:off */ other is MatrixWithDisplayName && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithDisplayName && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixWithDisplayNameConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, matrixWithDisplayNameConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MatrixWithDisplayName{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "MatrixWithDisplayName{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class BulkWithProration @@ -44987,6 +46153,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -45051,6 +46218,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -45080,6 +46250,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -45247,6 +46418,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -45468,6 +46648,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -45521,6 +46711,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -45553,6 +46744,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -45583,6 +46775,7 @@ private constructor( name = bulkWithProration.name planPhaseOrder = bulkWithProration.planPhaseOrder priceType = bulkWithProration.priceType + replacesPriceId = bulkWithProration.replacesPriceId dimensionalPriceConfiguration = bulkWithProration.dimensionalPriceConfiguration additionalProperties = bulkWithProration.additionalProperties.toMutableMap() } @@ -46115,6 +47308,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -46187,6 +47402,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -46217,6 +47433,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -46257,6 +47474,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -46301,6 +47519,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class BulkWithProrationConfig @@ -46990,17 +48209,17 @@ private constructor( return true } - return /* spotless:off */ other is BulkWithProration && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkWithProration && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && bulkWithProrationConfig == other.bulkWithProrationConfig && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bulkWithProrationConfig, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, bulkWithProrationConfig, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BulkWithProration{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "BulkWithProration{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, bulkWithProrationConfig=$bulkWithProrationConfig, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class GroupedTieredPackage @@ -47029,6 +48248,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -47093,6 +48313,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -47122,6 +48345,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -47289,6 +48513,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -47511,6 +48744,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -47564,6 +48807,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -47596,6 +48840,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -47626,6 +48871,7 @@ private constructor( name = groupedTieredPackage.name planPhaseOrder = groupedTieredPackage.planPhaseOrder priceType = groupedTieredPackage.priceType + replacesPriceId = groupedTieredPackage.replacesPriceId dimensionalPriceConfiguration = groupedTieredPackage.dimensionalPriceConfiguration additionalProperties = groupedTieredPackage.additionalProperties.toMutableMap() } @@ -48158,6 +49404,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -48230,6 +49498,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -48260,6 +49529,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -48300,6 +49570,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -48344,6 +49615,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -49033,17 +50305,17 @@ private constructor( return true } - return /* spotless:off */ other is GroupedTieredPackage && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedTieredPackageConfig == other.groupedTieredPackageConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTieredPackage && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && groupedTieredPackageConfig == other.groupedTieredPackageConfig && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedTieredPackageConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, groupedTieredPackageConfig, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "GroupedTieredPackage{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedTieredPackageConfig=$groupedTieredPackageConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "GroupedTieredPackage{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, groupedTieredPackageConfig=$groupedTieredPackageConfig, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class MaxGroupTieredPackage @@ -49072,6 +50344,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -49136,6 +50409,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -49165,6 +50441,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -49332,6 +50609,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -49554,6 +50840,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -49607,6 +50903,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -49639,6 +50936,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -49669,6 +50967,7 @@ private constructor( name = maxGroupTieredPackage.name planPhaseOrder = maxGroupTieredPackage.planPhaseOrder priceType = maxGroupTieredPackage.priceType + replacesPriceId = maxGroupTieredPackage.replacesPriceId dimensionalPriceConfiguration = maxGroupTieredPackage.dimensionalPriceConfiguration additionalProperties = maxGroupTieredPackage.additionalProperties.toMutableMap() } @@ -50202,6 +51501,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -50274,6 +51595,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -50304,6 +51626,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -50344,6 +51667,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -50388,6 +51712,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -51078,17 +52403,17 @@ private constructor( return true } - return /* spotless:off */ other is MaxGroupTieredPackage && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MaxGroupTieredPackage && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maxGroupTieredPackageConfig == other.maxGroupTieredPackageConfig && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maxGroupTieredPackageConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maxGroupTieredPackageConfig, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "MaxGroupTieredPackage{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "MaxGroupTieredPackage{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maxGroupTieredPackageConfig=$maxGroupTieredPackageConfig, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class ScalableMatrixWithUnitPricing @@ -51116,6 +52441,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val scalableMatrixWithUnitPricingConfig: JsonField, private val dimensionalPriceConfiguration: JsonField, @@ -51179,6 +52505,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("scalable_matrix_with_unit_pricing_config") @ExcludeMissing scalableMatrixWithUnitPricingConfig: JsonField = @@ -51211,6 +52540,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, scalableMatrixWithUnitPricingConfig, dimensionalPriceConfiguration, mutableMapOf(), @@ -51372,6 +52702,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -51592,6 +52931,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [scalableMatrixWithUnitPricingConfig]. * @@ -51656,6 +53005,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .scalableMatrixWithUnitPricingConfig() * ``` */ @@ -51688,6 +53038,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var scalableMatrixWithUnitPricingConfig: JsonField? = null @@ -51723,6 +53074,7 @@ private constructor( name = scalableMatrixWithUnitPricing.name planPhaseOrder = scalableMatrixWithUnitPricing.planPhaseOrder priceType = scalableMatrixWithUnitPricing.priceType + replacesPriceId = scalableMatrixWithUnitPricing.replacesPriceId scalableMatrixWithUnitPricingConfig = scalableMatrixWithUnitPricing.scalableMatrixWithUnitPricingConfig dimensionalPriceConfiguration = @@ -52245,6 +53597,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun scalableMatrixWithUnitPricingConfig( scalableMatrixWithUnitPricingConfig: ScalableMatrixWithUnitPricingConfig ) = @@ -52336,6 +53710,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .scalableMatrixWithUnitPricingConfig() * ``` * @@ -52366,6 +53741,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), checkRequired( "scalableMatrixWithUnitPricingConfig", scalableMatrixWithUnitPricingConfig, @@ -52409,6 +53785,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() scalableMatrixWithUnitPricingConfig().validate() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true @@ -52455,6 +53832,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (scalableMatrixWithUnitPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) @@ -53147,17 +54525,17 @@ private constructor( return true } - return /* spotless:off */ other is ScalableMatrixWithUnitPricing && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ScalableMatrixWithUnitPricing && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && scalableMatrixWithUnitPricingConfig == other.scalableMatrixWithUnitPricingConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, scalableMatrixWithUnitPricingConfig, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, scalableMatrixWithUnitPricingConfig, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ScalableMatrixWithUnitPricing{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "ScalableMatrixWithUnitPricing{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, scalableMatrixWithUnitPricingConfig=$scalableMatrixWithUnitPricingConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class ScalableMatrixWithTieredPricing @@ -53185,6 +54563,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val scalableMatrixWithTieredPricingConfig: JsonField, private val dimensionalPriceConfiguration: JsonField, @@ -53248,6 +54627,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("scalable_matrix_with_tiered_pricing_config") @ExcludeMissing scalableMatrixWithTieredPricingConfig: @@ -53281,6 +54663,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, scalableMatrixWithTieredPricingConfig, dimensionalPriceConfiguration, mutableMapOf(), @@ -53442,6 +54825,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -53662,6 +55054,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [scalableMatrixWithTieredPricingConfig]. * @@ -53726,6 +55128,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .scalableMatrixWithTieredPricingConfig() * ``` */ @@ -53758,6 +55161,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var scalableMatrixWithTieredPricingConfig: JsonField? = null @@ -53793,6 +55197,7 @@ private constructor( name = scalableMatrixWithTieredPricing.name planPhaseOrder = scalableMatrixWithTieredPricing.planPhaseOrder priceType = scalableMatrixWithTieredPricing.priceType + replacesPriceId = scalableMatrixWithTieredPricing.replacesPriceId scalableMatrixWithTieredPricingConfig = scalableMatrixWithTieredPricing.scalableMatrixWithTieredPricingConfig dimensionalPriceConfiguration = @@ -54315,6 +55720,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun scalableMatrixWithTieredPricingConfig( scalableMatrixWithTieredPricingConfig: ScalableMatrixWithTieredPricingConfig ) = @@ -54407,6 +55834,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * .scalableMatrixWithTieredPricingConfig() * ``` * @@ -54437,6 +55865,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), checkRequired( "scalableMatrixWithTieredPricingConfig", scalableMatrixWithTieredPricingConfig, @@ -54480,6 +55909,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() scalableMatrixWithTieredPricingConfig().validate() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true @@ -54526,6 +55956,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (scalableMatrixWithTieredPricingConfig.asKnown().getOrNull()?.validity() ?: 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) @@ -55218,17 +56649,17 @@ private constructor( return true } - return /* spotless:off */ other is ScalableMatrixWithTieredPricing && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ScalableMatrixWithTieredPricing && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && scalableMatrixWithTieredPricingConfig == other.scalableMatrixWithTieredPricingConfig && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, scalableMatrixWithTieredPricingConfig, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, scalableMatrixWithTieredPricingConfig, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ScalableMatrixWithTieredPricing{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "ScalableMatrixWithTieredPricing{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, scalableMatrixWithTieredPricingConfig=$scalableMatrixWithTieredPricingConfig, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } class CumulativeGroupedBulk @@ -55257,6 +56688,7 @@ private constructor( private val name: JsonField, private val planPhaseOrder: JsonField, private val priceType: JsonField, + private val replacesPriceId: JsonField, private val dimensionalPriceConfiguration: JsonField, private val additionalProperties: MutableMap, ) { @@ -55321,6 +56753,9 @@ private constructor( @JsonProperty("price_type") @ExcludeMissing priceType: JsonField = JsonMissing.of(), + @JsonProperty("replaces_price_id") + @ExcludeMissing + replacesPriceId: JsonField = JsonMissing.of(), @JsonProperty("dimensional_price_configuration") @ExcludeMissing dimensionalPriceConfiguration: JsonField = @@ -55350,6 +56785,7 @@ private constructor( name, planPhaseOrder, priceType, + replacesPriceId, dimensionalPriceConfiguration, mutableMapOf(), ) @@ -55517,6 +56953,15 @@ private constructor( */ fun priceType(): PriceType = priceType.getRequired("price_type") + /** + * The price id this price replaces. This price will take the place of the replaced price in + * plan version migrations. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun replacesPriceId(): Optional = replacesPriceId.getOptional("replaces_price_id") + /** * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -55739,6 +57184,16 @@ private constructor( @ExcludeMissing fun _priceType(): JsonField = priceType + /** + * Returns the raw JSON value of [replacesPriceId]. + * + * Unlike [replacesPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("replaces_price_id") + @ExcludeMissing + fun _replacesPriceId(): JsonField = replacesPriceId + /** * Returns the raw JSON value of [dimensionalPriceConfiguration]. * @@ -55792,6 +57247,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` */ @JvmStatic fun builder() = Builder() @@ -55824,6 +57280,7 @@ private constructor( private var name: JsonField? = null private var planPhaseOrder: JsonField? = null private var priceType: JsonField? = null + private var replacesPriceId: JsonField? = null private var dimensionalPriceConfiguration: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -55854,6 +57311,7 @@ private constructor( name = cumulativeGroupedBulk.name planPhaseOrder = cumulativeGroupedBulk.planPhaseOrder priceType = cumulativeGroupedBulk.priceType + replacesPriceId = cumulativeGroupedBulk.replacesPriceId dimensionalPriceConfiguration = cumulativeGroupedBulk.dimensionalPriceConfiguration additionalProperties = cumulativeGroupedBulk.additionalProperties.toMutableMap() } @@ -56387,6 +57845,28 @@ private constructor( */ fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + /** + * The price id this price replaces. This price will take the place of the replaced + * price in plan version migrations. + */ + fun replacesPriceId(replacesPriceId: String?) = + replacesPriceId(JsonField.ofNullable(replacesPriceId)) + + /** Alias for calling [Builder.replacesPriceId] with `replacesPriceId.orElse(null)`. */ + fun replacesPriceId(replacesPriceId: Optional) = + replacesPriceId(replacesPriceId.getOrNull()) + + /** + * Sets [Builder.replacesPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.replacesPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun replacesPriceId(replacesPriceId: JsonField) = apply { + this.replacesPriceId = replacesPriceId + } + fun dimensionalPriceConfiguration( dimensionalPriceConfiguration: DimensionalPriceConfiguration? ) = dimensionalPriceConfiguration(JsonField.ofNullable(dimensionalPriceConfiguration)) @@ -56459,6 +57939,7 @@ private constructor( * .name() * .planPhaseOrder() * .priceType() + * .replacesPriceId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -56489,6 +57970,7 @@ private constructor( checkRequired("name", name), checkRequired("planPhaseOrder", planPhaseOrder), checkRequired("priceType", priceType), + checkRequired("replacesPriceId", replacesPriceId), dimensionalPriceConfiguration, additionalProperties.toMutableMap(), ) @@ -56529,6 +58011,7 @@ private constructor( name() planPhaseOrder() priceType().validate() + replacesPriceId() dimensionalPriceConfiguration().ifPresent { it.validate() } validated = true } @@ -56573,6 +58056,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (planPhaseOrder.asKnown().isPresent) 1 else 0) + (priceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (replacesPriceId.asKnown().isPresent) 1 else 0) + (dimensionalPriceConfiguration.asKnown().getOrNull()?.validity() ?: 0) class Cadence @JsonCreator private constructor(private val value: JsonField) : @@ -57263,16 +58747,16 @@ private constructor( return true } - return /* spotless:off */ other is CumulativeGroupedBulk && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CumulativeGroupedBulk && id == other.id && billableMetric == other.billableMetric && billingCycleConfiguration == other.billingCycleConfiguration && cadence == other.cadence && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && createdAt == other.createdAt && creditAllocation == other.creditAllocation && cumulativeGroupedBulkConfig == other.cumulativeGroupedBulkConfig && currency == other.currency && discount == other.discount && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoicingCycleConfiguration == other.invoicingCycleConfiguration && item == other.item && maximum == other.maximum && maximumAmount == other.maximumAmount && metadata == other.metadata && minimum == other.minimum && minimumAmount == other.minimumAmount && modelType == other.modelType && name == other.name && planPhaseOrder == other.planPhaseOrder && priceType == other.priceType && replacesPriceId == other.replacesPriceId && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, cumulativeGroupedBulkConfig, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, dimensionalPriceConfiguration, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, billableMetric, billingCycleConfiguration, cadence, conversionRate, conversionRateConfig, createdAt, creditAllocation, cumulativeGroupedBulkConfig, currency, discount, externalPriceId, fixedPriceQuantity, invoicingCycleConfiguration, item, maximum, maximumAmount, metadata, minimum, minimumAmount, modelType, name, planPhaseOrder, priceType, replacesPriceId, dimensionalPriceConfiguration, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CumulativeGroupedBulk{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" + "CumulativeGroupedBulk{id=$id, billableMetric=$billableMetric, billingCycleConfiguration=$billingCycleConfiguration, cadence=$cadence, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, createdAt=$createdAt, creditAllocation=$creditAllocation, cumulativeGroupedBulkConfig=$cumulativeGroupedBulkConfig, currency=$currency, discount=$discount, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoicingCycleConfiguration=$invoicingCycleConfiguration, item=$item, maximum=$maximum, maximumAmount=$maximumAmount, metadata=$metadata, minimum=$minimum, minimumAmount=$minimumAmount, modelType=$modelType, name=$name, planPhaseOrder=$planPhaseOrder, priceType=$priceType, replacesPriceId=$replacesPriceId, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, additionalProperties=$additionalProperties}" } } 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 05adeb60..8ecb6c3a 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Alert @@ -15,6 +16,7 @@ import com.withorb.api.models.AlertListParams import com.withorb.api.models.AlertRetrieveParams import com.withorb.api.models.AlertUpdateParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface AlertServiceAsync { @@ -23,6 +25,13 @@ interface AlertServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): AlertServiceAsync + /** This endpoint retrieves an alert by its ID. */ fun retrieve(alertId: String): CompletableFuture = retrieve(alertId, AlertRetrieveParams.none()) @@ -301,6 +310,15 @@ interface AlertServiceAsync { /** A view of [AlertServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): AlertServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `get /alerts/{alert_id}`, but is otherwise the same as * [AlertServiceAsync.retrieve]. 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 b54ccfc7..158399fb 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 @@ -28,6 +28,7 @@ import com.withorb.api.models.AlertListParams import com.withorb.api.models.AlertRetrieveParams import com.withorb.api.models.AlertUpdateParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class AlertServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -39,6 +40,9 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie override fun withRawResponse(): AlertServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): AlertServiceAsync = + AlertServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun retrieve( params: AlertRetrieveParams, requestOptions: RequestOptions, @@ -100,6 +104,13 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): AlertServiceAsync.WithRawResponse = + AlertServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -113,6 +124,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) @@ -145,6 +157,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -176,6 +189,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts") .build() .prepareAsync(clientOptions, params) @@ -216,6 +230,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", "customer_id", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -249,6 +264,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", "external_customer_id", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -282,6 +298,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", "subscription_id", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -315,6 +332,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", params._pathParam(0), "disable") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -348,6 +366,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", params._pathParam(0), "enable") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/BetaServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/BetaServiceAsync.kt index 1f7d1538..64046733 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/BetaServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/BetaServiceAsync.kt @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.BetaCreatePlanVersionParams @@ -11,6 +12,7 @@ import com.withorb.api.models.Plan import com.withorb.api.models.PlanVersion import com.withorb.api.services.async.beta.ExternalPlanIdServiceAsync import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface BetaServiceAsync { @@ -19,6 +21,13 @@ interface BetaServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): BetaServiceAsync + fun externalPlanId(): ExternalPlanIdServiceAsync /** @@ -112,6 +121,13 @@ interface BetaServiceAsync { /** A view of [BetaServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): BetaServiceAsync.WithRawResponse + fun externalPlanId(): ExternalPlanIdServiceAsync.WithRawResponse /** diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/BetaServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/BetaServiceAsyncImpl.kt index 49bc2b07..5cb71fb1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/BetaServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/BetaServiceAsyncImpl.kt @@ -24,6 +24,7 @@ import com.withorb.api.models.PlanVersion import com.withorb.api.services.async.beta.ExternalPlanIdServiceAsync import com.withorb.api.services.async.beta.ExternalPlanIdServiceAsyncImpl import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class BetaServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -39,6 +40,9 @@ class BetaServiceAsyncImpl internal constructor(private val clientOptions: Clien override fun withRawResponse(): BetaServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): BetaServiceAsync = + BetaServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun externalPlanId(): ExternalPlanIdServiceAsync = externalPlanId override fun createPlanVersion( @@ -71,6 +75,13 @@ class BetaServiceAsyncImpl internal constructor(private val clientOptions: Clien ExternalPlanIdServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): BetaServiceAsync.WithRawResponse = + BetaServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun externalPlanId(): ExternalPlanIdServiceAsync.WithRawResponse = externalPlanId private val createPlanVersionHandler: Handler = @@ -86,6 +97,7 @@ class BetaServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", params._pathParam(0), "versions") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -119,6 +131,7 @@ class BetaServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "plans", params._pathParam(0), @@ -156,6 +169,7 @@ class BetaServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", params._pathParam(0), "set_default_version") .body(json(clientOptions.jsonMapper, params._body())) .build() 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 879fe8d7..04b142b9 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Coupon @@ -12,6 +13,7 @@ import com.withorb.api.models.CouponListPageAsync import com.withorb.api.models.CouponListParams import com.withorb.api.services.async.coupons.SubscriptionServiceAsync import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface CouponServiceAsync { @@ -20,6 +22,13 @@ interface CouponServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CouponServiceAsync + fun subscriptions(): SubscriptionServiceAsync /** @@ -136,6 +145,15 @@ interface CouponServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): CouponServiceAsync.WithRawResponse + fun subscriptions(): SubscriptionServiceAsync.WithRawResponse /** 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 e9232e59..77fe3712 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 @@ -26,6 +26,7 @@ import com.withorb.api.models.CouponListParams import com.withorb.api.services.async.coupons.SubscriptionServiceAsync import com.withorb.api.services.async.coupons.SubscriptionServiceAsyncImpl import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class CouponServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -41,6 +42,9 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli override fun withRawResponse(): CouponServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): CouponServiceAsync = + CouponServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun subscriptions(): SubscriptionServiceAsync = subscriptions override fun create( @@ -80,6 +84,13 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli SubscriptionServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): CouponServiceAsync.WithRawResponse = + CouponServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun subscriptions(): SubscriptionServiceAsync.WithRawResponse = subscriptions private val createHandler: Handler = @@ -92,6 +103,7 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("coupons") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -123,6 +135,7 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("coupons") .build() .prepareAsync(clientOptions, params) @@ -163,6 +176,7 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("coupons", params._pathParam(0), "archive") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -196,6 +210,7 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("coupons", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) 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 343713aa..e8cf1191 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.CreditNote @@ -10,6 +11,7 @@ import com.withorb.api.models.CreditNoteFetchParams import com.withorb.api.models.CreditNoteListPageAsync import com.withorb.api.models.CreditNoteListParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface CreditNoteServiceAsync { @@ -18,6 +20,13 @@ interface CreditNoteServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CreditNoteServiceAsync + /** This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). */ fun create(params: CreditNoteCreateParams): CompletableFuture = create(params, RequestOptions.none()) @@ -91,6 +100,15 @@ interface CreditNoteServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): CreditNoteServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `post /credit_notes`, but is otherwise the same as * [CreditNoteServiceAsync.create]. 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 c7261198..c803b183 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 @@ -23,6 +23,7 @@ import com.withorb.api.models.CreditNoteListPageAsync import com.withorb.api.models.CreditNoteListPageResponse import com.withorb.api.models.CreditNoteListParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -34,6 +35,9 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions: override fun withRawResponse(): CreditNoteServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): CreditNoteServiceAsync = + CreditNoteServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: CreditNoteCreateParams, requestOptions: RequestOptions, @@ -60,6 +64,13 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions: private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): CreditNoteServiceAsync.WithRawResponse = + CreditNoteServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -70,6 +81,7 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("credit_notes") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -101,6 +113,7 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("credit_notes") .build() .prepareAsync(clientOptions, params) @@ -141,6 +154,7 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("credit_notes", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) 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 7fdc5f0f..d7a49abe 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponse import com.withorb.api.core.http.HttpResponseFor @@ -20,6 +21,7 @@ import com.withorb.api.services.async.customers.BalanceTransactionServiceAsync import com.withorb.api.services.async.customers.CostServiceAsync import com.withorb.api.services.async.customers.CreditServiceAsync import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface CustomerServiceAsync { @@ -28,6 +30,13 @@ interface CustomerServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CustomerServiceAsync + fun costs(): CostServiceAsync fun credits(): CreditServiceAsync @@ -410,6 +419,15 @@ interface CustomerServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): CustomerServiceAsync.WithRawResponse + fun costs(): CostServiceAsync.WithRawResponse fun credits(): CreditServiceAsync.WithRawResponse 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 203abbad..20edac10 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 @@ -37,6 +37,7 @@ import com.withorb.api.services.async.customers.CostServiceAsyncImpl import com.withorb.api.services.async.customers.CreditServiceAsync import com.withorb.api.services.async.customers.CreditServiceAsyncImpl import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class CustomerServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -56,6 +57,9 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C override fun withRawResponse(): CustomerServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): CustomerServiceAsync = + CustomerServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun costs(): CostServiceAsync = costs override fun credits(): CreditServiceAsync = credits @@ -145,6 +149,13 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C BalanceTransactionServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): CustomerServiceAsync.WithRawResponse = + CustomerServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun costs(): CostServiceAsync.WithRawResponse = costs override fun credits(): CreditServiceAsync.WithRawResponse = credits @@ -162,6 +173,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -195,6 +207,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -226,6 +239,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers") .build() .prepareAsync(clientOptions, params) @@ -265,6 +279,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0)) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -290,6 +305,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) @@ -322,6 +338,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", "external_customer_id", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) @@ -354,6 +371,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", params._pathParam(0), @@ -385,6 +403,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", @@ -419,6 +438,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", "external_customer_id", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() 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 e511ab57..3a885f38 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.DimensionalPriceGroup @@ -11,6 +12,7 @@ import com.withorb.api.models.DimensionalPriceGroupListParams import com.withorb.api.models.DimensionalPriceGroupRetrieveParams import com.withorb.api.services.async.dimensionalPriceGroups.ExternalDimensionalPriceGroupIdServiceAsync import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface DimensionalPriceGroupServiceAsync { @@ -19,6 +21,13 @@ interface DimensionalPriceGroupServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): DimensionalPriceGroupServiceAsync + fun externalDimensionalPriceGroupId(): ExternalDimensionalPriceGroupIdServiceAsync /** @@ -111,6 +120,15 @@ interface DimensionalPriceGroupServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): DimensionalPriceGroupServiceAsync.WithRawResponse + fun externalDimensionalPriceGroupId(): ExternalDimensionalPriceGroupIdServiceAsync.WithRawResponse 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 8588a90b..80c26820 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 @@ -25,6 +25,7 @@ import com.withorb.api.models.DimensionalPriceGroups import com.withorb.api.services.async.dimensionalPriceGroups.ExternalDimensionalPriceGroupIdServiceAsync import com.withorb.api.services.async.dimensionalPriceGroups.ExternalDimensionalPriceGroupIdServiceAsyncImpl import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class DimensionalPriceGroupServiceAsyncImpl @@ -42,6 +43,13 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric override fun withRawResponse(): DimensionalPriceGroupServiceAsync.WithRawResponse = withRawResponse + override fun withOptions( + modifier: Consumer + ): DimensionalPriceGroupServiceAsync = + DimensionalPriceGroupServiceAsyncImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun externalDimensionalPriceGroupId(): ExternalDimensionalPriceGroupIdServiceAsync = externalDimensionalPriceGroupId @@ -76,6 +84,13 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric ExternalDimensionalPriceGroupIdServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): DimensionalPriceGroupServiceAsync.WithRawResponse = + DimensionalPriceGroupServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun externalDimensionalPriceGroupId(): ExternalDimensionalPriceGroupIdServiceAsync.WithRawResponse = externalDimensionalPriceGroupId @@ -91,6 +106,7 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("dimensional_price_groups") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -125,6 +141,7 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("dimensional_price_groups", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) @@ -155,6 +172,7 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("dimensional_price_groups") .build() .prepareAsync(clientOptions, params) 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 ae596b81..637d8dee 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.EventDeprecateParams @@ -15,6 +16,7 @@ import com.withorb.api.models.EventUpdateResponse import com.withorb.api.services.async.events.BackfillServiceAsync import com.withorb.api.services.async.events.VolumeServiceAsync import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface EventServiceAsync { @@ -23,6 +25,13 @@ interface EventServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): EventServiceAsync + fun backfills(): BackfillServiceAsync fun volume(): VolumeServiceAsync @@ -387,6 +396,15 @@ interface EventServiceAsync { /** A view of [EventServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): EventServiceAsync.WithRawResponse + fun backfills(): BackfillServiceAsync.WithRawResponse fun volume(): VolumeServiceAsync.WithRawResponse 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 84575534..397718b5 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 @@ -29,6 +29,7 @@ import com.withorb.api.services.async.events.BackfillServiceAsyncImpl import com.withorb.api.services.async.events.VolumeServiceAsync import com.withorb.api.services.async.events.VolumeServiceAsyncImpl import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class EventServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -44,6 +45,9 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie override fun withRawResponse(): EventServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): EventServiceAsync = + EventServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun backfills(): BackfillServiceAsync = backfills override fun volume(): VolumeServiceAsync = volume @@ -89,6 +93,13 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie VolumeServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): EventServiceAsync.WithRawResponse = + EventServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun backfills(): BackfillServiceAsync.WithRawResponse = backfills override fun volume(): VolumeServiceAsync.WithRawResponse = volume @@ -107,6 +118,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -141,6 +153,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", params._pathParam(0), "deprecate") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -172,6 +185,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("ingest") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -203,6 +217,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "search") .body(json(clientOptions.jsonMapper, params._body())) .build() 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 b7c7ad7c..c26da1bf 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 @@ -2,11 +2,13 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.InvoiceLineItemCreateParams import com.withorb.api.models.InvoiceLineItemCreateResponse import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface InvoiceLineItemServiceAsync { @@ -15,6 +17,13 @@ interface InvoiceLineItemServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): InvoiceLineItemServiceAsync + /** * This creates a one-off fixed fee invoice line item on an Invoice. This can only be done for * invoices that are in a `draft` status. @@ -35,6 +44,15 @@ interface InvoiceLineItemServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): InvoiceLineItemServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `post /invoice_line_items`, but is otherwise the same as * [InvoiceLineItemServiceAsync.create]. 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 223f00bc..5993e255 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,6 +18,7 @@ import com.withorb.api.core.prepareAsync import com.withorb.api.models.InvoiceLineItemCreateParams import com.withorb.api.models.InvoiceLineItemCreateResponse import java.util.concurrent.CompletableFuture +import java.util.function.Consumer class InvoiceLineItemServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : InvoiceLineItemServiceAsync { @@ -28,6 +29,11 @@ internal constructor(private val clientOptions: ClientOptions) : InvoiceLineItem override fun withRawResponse(): InvoiceLineItemServiceAsync.WithRawResponse = withRawResponse + override fun withOptions( + modifier: Consumer + ): InvoiceLineItemServiceAsync = + InvoiceLineItemServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: InvoiceLineItemCreateParams, requestOptions: RequestOptions, @@ -40,6 +46,13 @@ internal constructor(private val clientOptions: ClientOptions) : InvoiceLineItem private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): InvoiceLineItemServiceAsync.WithRawResponse = + InvoiceLineItemServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -51,6 +64,7 @@ internal constructor(private val clientOptions: ClientOptions) : InvoiceLineItem val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoice_line_items") .body(json(clientOptions.jsonMapper, params._body())) .build() 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 7380dd06..73c3b588 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Invoice @@ -17,6 +18,7 @@ import com.withorb.api.models.InvoicePayParams import com.withorb.api.models.InvoiceUpdateParams import com.withorb.api.models.InvoiceVoidInvoiceParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface InvoiceServiceAsync { @@ -25,6 +27,13 @@ interface InvoiceServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): InvoiceServiceAsync + /** This endpoint is used to create a one-off invoice for a customer. */ fun create(params: InvoiceCreateParams): CompletableFuture = create(params, RequestOptions.none()) @@ -297,6 +306,15 @@ interface InvoiceServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): InvoiceServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `post /invoices`, but is otherwise the same as * [InvoiceServiceAsync.create]. 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 4470c68a..3fceafcc 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 @@ -30,6 +30,7 @@ import com.withorb.api.models.InvoicePayParams import com.withorb.api.models.InvoiceUpdateParams import com.withorb.api.models.InvoiceVoidInvoiceParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -41,6 +42,9 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl override fun withRawResponse(): InvoiceServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): InvoiceServiceAsync = + InvoiceServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: InvoiceCreateParams, requestOptions: RequestOptions, @@ -109,6 +113,13 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): InvoiceServiceAsync.WithRawResponse = + InvoiceServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -119,6 +130,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -152,6 +164,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -183,6 +196,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices") .build() .prepareAsync(clientOptions, params) @@ -223,6 +237,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) @@ -253,6 +268,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", "upcoming") .build() .prepareAsync(clientOptions, params) @@ -285,6 +301,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", params._pathParam(0), "issue") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -318,6 +335,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", params._pathParam(0), "mark_paid") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -351,6 +369,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", params._pathParam(0), "pay") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -384,6 +403,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", params._pathParam(0), "void") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() 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 2d34e75c..ecd14f7e 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Item @@ -12,6 +13,7 @@ import com.withorb.api.models.ItemListPageAsync import com.withorb.api.models.ItemListParams import com.withorb.api.models.ItemUpdateParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface ItemServiceAsync { @@ -20,6 +22,13 @@ interface ItemServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ItemServiceAsync + /** This endpoint is used to create an [Item](/core-concepts#item). */ fun create(params: ItemCreateParams): CompletableFuture = create(params, RequestOptions.none()) @@ -140,6 +149,13 @@ interface ItemServiceAsync { /** A view of [ItemServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ItemServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `post /items`, but is otherwise the same as * [ItemServiceAsync.create]. 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 4e405145..a8c776b0 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 @@ -25,6 +25,7 @@ import com.withorb.api.models.ItemListPageResponse import com.withorb.api.models.ItemListParams import com.withorb.api.models.ItemUpdateParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class ItemServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -36,6 +37,9 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien override fun withRawResponse(): ItemServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): ItemServiceAsync = + ItemServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: ItemCreateParams, requestOptions: RequestOptions, @@ -76,6 +80,13 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): ItemServiceAsync.WithRawResponse = + ItemServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -86,6 +97,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("items") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -119,6 +131,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("items", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -150,6 +163,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("items") .build() .prepareAsync(clientOptions, params) @@ -190,6 +204,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("items", params._pathParam(0), "archive") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -223,6 +238,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("items", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) 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 cbc03486..ffb3fbd1 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.BillableMetric @@ -11,6 +12,7 @@ import com.withorb.api.models.MetricListPageAsync import com.withorb.api.models.MetricListParams import com.withorb.api.models.MetricUpdateParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface MetricServiceAsync { @@ -19,6 +21,13 @@ interface MetricServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): MetricServiceAsync + /** * This endpoint is used to create a [metric](/core-concepts###metric) using a SQL string. See * [SQL support](/extensibility/advanced-metrics#sql-support) for a description of constructing @@ -133,6 +142,15 @@ interface MetricServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): MetricServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `post /metrics`, but is otherwise the same as * [MetricServiceAsync.create]. 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 9c2a533b..ba202aff 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 @@ -24,6 +24,7 @@ import com.withorb.api.models.MetricListPageResponse import com.withorb.api.models.MetricListParams import com.withorb.api.models.MetricUpdateParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class MetricServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -35,6 +36,9 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli override fun withRawResponse(): MetricServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): MetricServiceAsync = + MetricServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: MetricCreateParams, requestOptions: RequestOptions, @@ -68,6 +72,13 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): MetricServiceAsync.WithRawResponse = + MetricServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -78,6 +89,7 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("metrics") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -111,6 +123,7 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("metrics", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -142,6 +155,7 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("metrics") .build() .prepareAsync(clientOptions, params) @@ -182,6 +196,7 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("metrics", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) 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 0fc014c7..39b9d35c 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Plan @@ -12,6 +13,7 @@ import com.withorb.api.models.PlanListParams import com.withorb.api.models.PlanUpdateParams import com.withorb.api.services.async.plans.ExternalPlanIdServiceAsync import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface PlanServiceAsync { @@ -20,6 +22,13 @@ interface PlanServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): PlanServiceAsync + fun externalPlanId(): ExternalPlanIdServiceAsync /** This endpoint allows creation of plans including their prices. */ @@ -139,6 +148,13 @@ interface PlanServiceAsync { /** A view of [PlanServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): PlanServiceAsync.WithRawResponse + fun externalPlanId(): ExternalPlanIdServiceAsync.WithRawResponse /** 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 5a2dc237..f57206ee 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 @@ -26,6 +26,7 @@ import com.withorb.api.models.PlanUpdateParams import com.withorb.api.services.async.plans.ExternalPlanIdServiceAsync import com.withorb.api.services.async.plans.ExternalPlanIdServiceAsyncImpl import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class PlanServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -41,6 +42,9 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien override fun withRawResponse(): PlanServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): PlanServiceAsync = + PlanServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun externalPlanId(): ExternalPlanIdServiceAsync = externalPlanId override fun create( @@ -80,6 +84,13 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien ExternalPlanIdServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): PlanServiceAsync.WithRawResponse = + PlanServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun externalPlanId(): ExternalPlanIdServiceAsync.WithRawResponse = externalPlanId private val createHandler: Handler = @@ -92,6 +103,7 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -125,6 +137,7 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -156,6 +169,7 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans") .build() .prepareAsync(clientOptions, params) @@ -196,6 +210,7 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) 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 ea396c1b..8f59abf3 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Price @@ -18,6 +19,7 @@ import com.withorb.api.models.PriceListParams import com.withorb.api.models.PriceUpdateParams import com.withorb.api.services.async.prices.ExternalPriceIdServiceAsync import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface PriceServiceAsync { @@ -26,6 +28,13 @@ interface PriceServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): PriceServiceAsync + fun externalPriceId(): ExternalPriceIdServiceAsync /** @@ -248,6 +257,15 @@ interface PriceServiceAsync { /** A view of [PriceServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): PriceServiceAsync.WithRawResponse + fun externalPriceId(): ExternalPriceIdServiceAsync.WithRawResponse /** 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 5ba1ca66..b0b0530d 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 @@ -32,6 +32,7 @@ import com.withorb.api.models.PriceUpdateParams import com.withorb.api.services.async.prices.ExternalPriceIdServiceAsync import com.withorb.api.services.async.prices.ExternalPriceIdServiceAsyncImpl import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class PriceServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -47,6 +48,9 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie override fun withRawResponse(): PriceServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): PriceServiceAsync = + PriceServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun externalPriceId(): ExternalPriceIdServiceAsync = externalPriceId override fun create( @@ -107,6 +111,13 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie ExternalPriceIdServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): PriceServiceAsync.WithRawResponse = + PriceServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun externalPriceId(): ExternalPriceIdServiceAsync.WithRawResponse = externalPriceId @@ -120,6 +131,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -153,6 +165,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -184,6 +197,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices") .build() .prepareAsync(clientOptions, params) @@ -225,6 +239,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", params._pathParam(0), "evaluate") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -256,6 +271,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", "evaluate") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -287,6 +303,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", "evaluate_preview_events") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -320,6 +337,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsync.kt index 979f7567..12b5b156 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsync.kt @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.SubscriptionChangeApplyParams @@ -11,6 +12,7 @@ import com.withorb.api.models.SubscriptionChangeCancelResponse import com.withorb.api.models.SubscriptionChangeRetrieveParams import com.withorb.api.models.SubscriptionChangeRetrieveResponse import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface SubscriptionChangeServiceAsync { @@ -19,6 +21,13 @@ interface SubscriptionChangeServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SubscriptionChangeServiceAsync + /** * This endpoint returns a subscription change given an identifier. * @@ -162,6 +171,15 @@ interface SubscriptionChangeServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): SubscriptionChangeServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `get /subscription_changes/{subscription_change_id}`, but * is otherwise the same as [SubscriptionChangeServiceAsync.retrieve]. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncImpl.kt index adb221d9..41b34576 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncImpl.kt @@ -23,6 +23,7 @@ import com.withorb.api.models.SubscriptionChangeCancelResponse import com.withorb.api.models.SubscriptionChangeRetrieveParams import com.withorb.api.models.SubscriptionChangeRetrieveResponse import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class SubscriptionChangeServiceAsyncImpl @@ -34,6 +35,13 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha override fun withRawResponse(): SubscriptionChangeServiceAsync.WithRawResponse = withRawResponse + override fun withOptions( + modifier: Consumer + ): SubscriptionChangeServiceAsync = + SubscriptionChangeServiceAsyncImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun retrieve( params: SubscriptionChangeRetrieveParams, requestOptions: RequestOptions, @@ -60,6 +68,13 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): SubscriptionChangeServiceAsync.WithRawResponse = + SubscriptionChangeServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -74,6 +89,7 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscription_changes", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) @@ -107,6 +123,7 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscription_changes", params._pathParam(0), "apply") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -141,6 +158,7 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscription_changes", params._pathParam(0), "cancel") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() 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 c9b48ded..ef60a903 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.MutatedSubscription @@ -28,6 +29,7 @@ import com.withorb.api.models.SubscriptionUpdateParams import com.withorb.api.models.SubscriptionUpdateTrialParams import com.withorb.api.models.SubscriptionUsage import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface SubscriptionServiceAsync { @@ -36,6 +38,13 @@ interface SubscriptionServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SubscriptionServiceAsync + /** * A subscription represents the purchase of a plan by a customer. The customer is identified by * either the `customer_id` or the `external_customer_id`, and exactly one of these fields must @@ -1370,6 +1379,15 @@ interface SubscriptionServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): SubscriptionServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `post /subscriptions`, but is otherwise the same as * [SubscriptionServiceAsync.create]. 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 edf83e62..0ea0f6af 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 @@ -42,6 +42,7 @@ import com.withorb.api.models.SubscriptionUpdateTrialParams import com.withorb.api.models.SubscriptionUsage import com.withorb.api.models.Subscriptions import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class SubscriptionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -53,6 +54,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption override fun withRawResponse(): SubscriptionServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): SubscriptionServiceAsync = + SubscriptionServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: SubscriptionCreateParams, requestOptions: RequestOptions, @@ -181,6 +185,13 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): SubscriptionServiceAsync.WithRawResponse = + SubscriptionServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -192,6 +203,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -225,6 +237,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -255,6 +268,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions") .build() .prepareAsync(clientOptions, params) @@ -296,6 +310,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "cancel") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -329,6 +344,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) @@ -362,6 +378,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "costs") .build() .prepareAsync(clientOptions, params) @@ -395,6 +412,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "schedule") .build() .prepareAsync(clientOptions, params) @@ -435,6 +453,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "usage") .build() .prepareAsync(clientOptions, params) @@ -468,6 +487,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "price_intervals") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -502,6 +522,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "redeem_coupon") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -536,6 +557,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "schedule_plan_change") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -570,6 +592,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "trigger_phase") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -604,6 +627,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "subscriptions", params._pathParam(0), @@ -642,6 +666,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "subscriptions", params._pathParam(0), @@ -680,6 +705,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "subscriptions", params._pathParam(0), @@ -718,6 +744,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "subscriptions", params._pathParam(0), @@ -756,6 +783,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "update_trial") .body(json(clientOptions.jsonMapper, params._body())) .build() 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 07773609..c1f036fd 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 @@ -2,11 +2,13 @@ package com.withorb.api.services.async +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.TopLevelPingParams import com.withorb.api.models.TopLevelPingResponse import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface TopLevelServiceAsync { @@ -15,6 +17,13 @@ interface TopLevelServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): TopLevelServiceAsync + /** * This endpoint allows you to test your connection to the Orb API and check the validity of * your API key, passed in the Authorization header. This is particularly useful for checking @@ -45,6 +54,15 @@ interface TopLevelServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): TopLevelServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `get /ping`, but is otherwise the same as * [TopLevelServiceAsync.ping]. 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 c7520c7a..f2d8276c 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 @@ -17,6 +17,7 @@ import com.withorb.api.core.prepareAsync import com.withorb.api.models.TopLevelPingParams import com.withorb.api.models.TopLevelPingResponse import java.util.concurrent.CompletableFuture +import java.util.function.Consumer class TopLevelServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : TopLevelServiceAsync { @@ -27,6 +28,9 @@ class TopLevelServiceAsyncImpl internal constructor(private val clientOptions: C override fun withRawResponse(): TopLevelServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): TopLevelServiceAsync = + TopLevelServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun ping( params: TopLevelPingParams, requestOptions: RequestOptions, @@ -39,6 +43,13 @@ class TopLevelServiceAsyncImpl internal constructor(private val clientOptions: C private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): TopLevelServiceAsync.WithRawResponse = + TopLevelServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val pingHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -50,6 +61,7 @@ class TopLevelServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("ping") .build() .prepareAsync(clientOptions, params) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/beta/ExternalPlanIdServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/beta/ExternalPlanIdServiceAsync.kt index 3439889a..eb64f2e3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/beta/ExternalPlanIdServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/beta/ExternalPlanIdServiceAsync.kt @@ -2,6 +2,7 @@ package com.withorb.api.services.async.beta +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.BetaExternalPlanIdCreatePlanVersionParams @@ -10,6 +11,7 @@ import com.withorb.api.models.BetaExternalPlanIdSetDefaultPlanVersionParams import com.withorb.api.models.Plan import com.withorb.api.models.PlanVersion import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface ExternalPlanIdServiceAsync { @@ -18,6 +20,13 @@ interface ExternalPlanIdServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ExternalPlanIdServiceAsync + /** * This API endpoint is in beta and its interface may change. It is recommended for use only in * test mode. @@ -120,6 +129,15 @@ interface ExternalPlanIdServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ExternalPlanIdServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `post * /plans/external_plan_id/{external_plan_id}/versions`, but is otherwise the same as diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/beta/ExternalPlanIdServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/beta/ExternalPlanIdServiceAsyncImpl.kt index c62334e5..7be5dc93 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/beta/ExternalPlanIdServiceAsyncImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/beta/ExternalPlanIdServiceAsyncImpl.kt @@ -22,6 +22,7 @@ import com.withorb.api.models.BetaExternalPlanIdSetDefaultPlanVersionParams import com.withorb.api.models.Plan import com.withorb.api.models.PlanVersion import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class ExternalPlanIdServiceAsyncImpl @@ -33,6 +34,11 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdS override fun withRawResponse(): ExternalPlanIdServiceAsync.WithRawResponse = withRawResponse + override fun withOptions( + modifier: Consumer + ): ExternalPlanIdServiceAsync = + ExternalPlanIdServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun createPlanVersion( params: BetaExternalPlanIdCreatePlanVersionParams, requestOptions: RequestOptions, @@ -59,6 +65,13 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdS private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): ExternalPlanIdServiceAsync.WithRawResponse = + ExternalPlanIdServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createPlanVersionHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -72,6 +85,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdS val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", "external_plan_id", params._pathParam(0), "versions") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -105,6 +119,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdS val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "plans", "external_plan_id", @@ -143,6 +158,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdS val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "plans", "external_plan_id", 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 02ab9530..90d38be3 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 @@ -2,11 +2,13 @@ package com.withorb.api.services.async.coupons +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.CouponSubscriptionListPageAsync import com.withorb.api.models.CouponSubscriptionListParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface SubscriptionServiceAsync { @@ -15,6 +17,13 @@ interface SubscriptionServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SubscriptionServiceAsync + /** * This endpoint returns a list of all subscriptions that have redeemed a given coupon as a * [paginated](/api-reference/pagination) list, ordered starting from the most recently created @@ -63,6 +72,15 @@ interface SubscriptionServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): SubscriptionServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `get /coupons/{coupon_id}/subscriptions`, but is * otherwise the same as [SubscriptionServiceAsync.list]. 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 0374a852..7edc9cb6 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 @@ -19,6 +19,7 @@ import com.withorb.api.models.CouponSubscriptionListPageAsync import com.withorb.api.models.CouponSubscriptionListParams import com.withorb.api.models.Subscriptions import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class SubscriptionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -30,6 +31,9 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption override fun withRawResponse(): SubscriptionServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): SubscriptionServiceAsync = + SubscriptionServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun list( params: CouponSubscriptionListParams, requestOptions: RequestOptions, @@ -42,6 +46,13 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): SubscriptionServiceAsync.WithRawResponse = + SubscriptionServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -55,6 +66,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("coupons", params._pathParam(0), "subscriptions") .build() .prepareAsync(clientOptions, params) 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 b7f8d93e..6cce09b2 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async.customers +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.CustomerBalanceTransactionCreateParams @@ -9,6 +10,7 @@ import com.withorb.api.models.CustomerBalanceTransactionCreateResponse import com.withorb.api.models.CustomerBalanceTransactionListPageAsync import com.withorb.api.models.CustomerBalanceTransactionListParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface BalanceTransactionServiceAsync { @@ -17,6 +19,13 @@ interface BalanceTransactionServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): BalanceTransactionServiceAsync + /** * Creates an immutable balance transaction that updates the customer's balance and returns back * the newly created transaction. @@ -111,6 +120,15 @@ interface BalanceTransactionServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): BalanceTransactionServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `post /customers/{customer_id}/balance_transactions`, but * is otherwise the same as [BalanceTransactionServiceAsync.create]. 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 817135f9..d4337539 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 @@ -22,6 +22,7 @@ import com.withorb.api.models.CustomerBalanceTransactionListPageAsync import com.withorb.api.models.CustomerBalanceTransactionListPageResponse import com.withorb.api.models.CustomerBalanceTransactionListParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class BalanceTransactionServiceAsyncImpl @@ -33,6 +34,13 @@ internal constructor(private val clientOptions: ClientOptions) : BalanceTransact override fun withRawResponse(): BalanceTransactionServiceAsync.WithRawResponse = withRawResponse + override fun withOptions( + modifier: Consumer + ): BalanceTransactionServiceAsync = + BalanceTransactionServiceAsyncImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun create( params: CustomerBalanceTransactionCreateParams, requestOptions: RequestOptions, @@ -52,6 +60,13 @@ internal constructor(private val clientOptions: ClientOptions) : BalanceTransact private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): BalanceTransactionServiceAsync.WithRawResponse = + BalanceTransactionServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -66,6 +81,7 @@ internal constructor(private val clientOptions: ClientOptions) : BalanceTransact val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "balance_transactions") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -100,6 +116,7 @@ internal constructor(private val clientOptions: ClientOptions) : BalanceTransact val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "balance_transactions") .build() .prepareAsync(clientOptions, params) 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 37d541d3..f3033f77 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async.customers +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.CustomerCostListByExternalIdParams @@ -9,6 +10,7 @@ import com.withorb.api.models.CustomerCostListByExternalIdResponse import com.withorb.api.models.CustomerCostListParams import com.withorb.api.models.CustomerCostListResponse import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface CostServiceAsync { @@ -17,6 +19,13 @@ interface CostServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CostServiceAsync + /** * This endpoint is used to fetch a day-by-day snapshot of a customer's costs in Orb, calculated * by applying pricing information to the underlying usage (see the @@ -320,6 +329,13 @@ interface CostServiceAsync { /** A view of [CostServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CostServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `get /customers/{customer_id}/costs`, but is otherwise * the same as [CostServiceAsync.list]. 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 49415184..7437de1f 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 @@ -20,6 +20,7 @@ import com.withorb.api.models.CustomerCostListByExternalIdResponse import com.withorb.api.models.CustomerCostListParams import com.withorb.api.models.CustomerCostListResponse import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class CostServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -31,6 +32,9 @@ class CostServiceAsyncImpl internal constructor(private val clientOptions: Clien override fun withRawResponse(): CostServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): CostServiceAsync = + CostServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun list( params: CustomerCostListParams, requestOptions: RequestOptions, @@ -50,6 +54,13 @@ class CostServiceAsyncImpl internal constructor(private val clientOptions: Clien private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): CostServiceAsync.WithRawResponse = + CostServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -64,6 +75,7 @@ class CostServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "costs") .build() .prepareAsync(clientOptions, params) @@ -97,6 +109,7 @@ class CostServiceAsyncImpl internal constructor(private val clientOptions: Clien val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", 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 892f9259..c7325b6b 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async.customers +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.CustomerCreditListByExternalIdPageAsync @@ -11,6 +12,7 @@ import com.withorb.api.models.CustomerCreditListParams import com.withorb.api.services.async.customers.credits.LedgerServiceAsync import com.withorb.api.services.async.customers.credits.TopUpServiceAsync import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface CreditServiceAsync { @@ -19,6 +21,13 @@ interface CreditServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CreditServiceAsync + fun ledger(): LedgerServiceAsync fun topUps(): TopUpServiceAsync @@ -127,6 +136,15 @@ interface CreditServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): CreditServiceAsync.WithRawResponse + fun ledger(): LedgerServiceAsync.WithRawResponse fun topUps(): TopUpServiceAsync.WithRawResponse 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 2e201b33..fbfc2ee2 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 @@ -26,6 +26,7 @@ import com.withorb.api.services.async.customers.credits.LedgerServiceAsyncImpl import com.withorb.api.services.async.customers.credits.TopUpServiceAsync import com.withorb.api.services.async.customers.credits.TopUpServiceAsyncImpl import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class CreditServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -41,6 +42,9 @@ class CreditServiceAsyncImpl internal constructor(private val clientOptions: Cli override fun withRawResponse(): CreditServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): CreditServiceAsync = + CreditServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun ledger(): LedgerServiceAsync = ledger override fun topUps(): TopUpServiceAsync = topUps @@ -72,6 +76,13 @@ class CreditServiceAsyncImpl internal constructor(private val clientOptions: Cli TopUpServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): CreditServiceAsync.WithRawResponse = + CreditServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun ledger(): LedgerServiceAsync.WithRawResponse = ledger override fun topUps(): TopUpServiceAsync.WithRawResponse = topUps @@ -90,6 +101,7 @@ class CreditServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "credits") .build() .prepareAsync(clientOptions, params) @@ -131,6 +143,7 @@ class CreditServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", 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 b9a22945..9ab63fa3 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async.customers.credits +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.CustomerCreditLedgerCreateEntryByExternalIdParams @@ -13,6 +14,7 @@ import com.withorb.api.models.CustomerCreditLedgerListByExternalIdParams import com.withorb.api.models.CustomerCreditLedgerListPageAsync import com.withorb.api.models.CustomerCreditLedgerListParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface LedgerServiceAsync { @@ -21,6 +23,13 @@ interface LedgerServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): LedgerServiceAsync + /** * The credits ledger provides _auditing_ functionality over Orb's credits system with a list of * actions that have taken place to modify a customer's credit balance. This @@ -529,6 +538,15 @@ interface LedgerServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): LedgerServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `get /customers/{customer_id}/credits/ledger`, but is * otherwise the same as [LedgerServiceAsync.list]. 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 f168ea41..63b57286 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 @@ -27,6 +27,7 @@ import com.withorb.api.models.CustomerCreditLedgerListPageAsync import com.withorb.api.models.CustomerCreditLedgerListPageResponse import com.withorb.api.models.CustomerCreditLedgerListParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class LedgerServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -38,6 +39,9 @@ class LedgerServiceAsyncImpl internal constructor(private val clientOptions: Cli override fun withRawResponse(): LedgerServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): LedgerServiceAsync = + LedgerServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun list( params: CustomerCreditLedgerListParams, requestOptions: RequestOptions, @@ -71,6 +75,13 @@ class LedgerServiceAsyncImpl internal constructor(private val clientOptions: Cli private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): LedgerServiceAsync.WithRawResponse = + LedgerServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -85,6 +96,7 @@ class LedgerServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "credits", "ledger") .build() .prepareAsync(clientOptions, params) @@ -126,6 +138,7 @@ class LedgerServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "credits", "ledger_entry") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -163,6 +176,7 @@ class LedgerServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", @@ -204,6 +218,7 @@ class LedgerServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", 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 cc6c1df2..b03d49f5 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async.customers.credits +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponse import com.withorb.api.core.http.HttpResponseFor @@ -16,6 +17,7 @@ import com.withorb.api.models.CustomerCreditTopUpListByExternalIdParams import com.withorb.api.models.CustomerCreditTopUpListPageAsync import com.withorb.api.models.CustomerCreditTopUpListParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface TopUpServiceAsync { @@ -24,6 +26,13 @@ interface TopUpServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): TopUpServiceAsync + /** * This endpoint allows you to create a new top-up for a specified customer's balance. While * this top-up is active, the customer's balance will added in increments of the specified @@ -236,6 +245,15 @@ interface TopUpServiceAsync { /** A view of [TopUpServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): TopUpServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `post /customers/{customer_id}/credits/top_ups`, but is * otherwise the same as [TopUpServiceAsync.create]. 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 b8c3b4fb..c59f5d1b 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 @@ -31,6 +31,7 @@ import com.withorb.api.models.CustomerCreditTopUpListPageAsync import com.withorb.api.models.CustomerCreditTopUpListPageResponse import com.withorb.api.models.CustomerCreditTopUpListParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class TopUpServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -42,6 +43,9 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie override fun withRawResponse(): TopUpServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): TopUpServiceAsync = + TopUpServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: CustomerCreditTopUpCreateParams, requestOptions: RequestOptions, @@ -89,6 +93,13 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): TopUpServiceAsync.WithRawResponse = + TopUpServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -103,6 +114,7 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "credits", "top_ups") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -137,6 +149,7 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "credits", "top_ups") .build() .prepareAsync(clientOptions, params) @@ -176,6 +189,7 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", params._pathParam(0), @@ -209,6 +223,7 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", @@ -248,6 +263,7 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", @@ -282,6 +298,7 @@ class TopUpServiceAsyncImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", 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 4c3e01d4..feccd338 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 @@ -2,11 +2,13 @@ package com.withorb.api.services.async.dimensionalPriceGroups +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.DimensionalPriceGroup import com.withorb.api.models.DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface ExternalDimensionalPriceGroupIdServiceAsync { @@ -15,6 +17,15 @@ interface ExternalDimensionalPriceGroupIdServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ExternalDimensionalPriceGroupIdServiceAsync + /** Fetch dimensional price group by external ID */ fun retrieve( externalDimensionalPriceGroupId: String @@ -75,6 +86,15 @@ interface ExternalDimensionalPriceGroupIdServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ExternalDimensionalPriceGroupIdServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `get * /dimensional_price_groups/external_dimensional_price_group_id/{external_dimensional_price_group_id}`, 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 e7f51a77..37e6f542 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 @@ -18,6 +18,7 @@ import com.withorb.api.core.prepareAsync import com.withorb.api.models.DimensionalPriceGroup import com.withorb.api.models.DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class ExternalDimensionalPriceGroupIdServiceAsyncImpl @@ -32,6 +33,13 @@ internal constructor(private val clientOptions: ClientOptions) : override fun withRawResponse(): ExternalDimensionalPriceGroupIdServiceAsync.WithRawResponse = withRawResponse + override fun withOptions( + modifier: Consumer + ): ExternalDimensionalPriceGroupIdServiceAsync = + ExternalDimensionalPriceGroupIdServiceAsyncImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun retrieve( params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams, requestOptions: RequestOptions, @@ -45,6 +53,13 @@ internal constructor(private val clientOptions: ClientOptions) : private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): ExternalDimensionalPriceGroupIdServiceAsync.WithRawResponse = + ExternalDimensionalPriceGroupIdServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -62,6 +77,7 @@ internal constructor(private val clientOptions: ClientOptions) : val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "dimensional_price_groups", "external_dimensional_price_group_id", 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 11d28adc..ae906f69 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 @@ -2,6 +2,7 @@ package com.withorb.api.services.async.events +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.EventBackfillCloseParams @@ -15,6 +16,7 @@ import com.withorb.api.models.EventBackfillListParams import com.withorb.api.models.EventBackfillRevertParams import com.withorb.api.models.EventBackfillRevertResponse import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface BackfillServiceAsync { @@ -23,6 +25,13 @@ interface BackfillServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): BackfillServiceAsync + /** * Creating the backfill enables adding or replacing past events, even those that are older than * the ingestion grace period. Performing a backfill in Orb involves 3 steps: @@ -211,6 +220,15 @@ interface BackfillServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): BackfillServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `post /events/backfills`, but is otherwise the same as * [BackfillServiceAsync.create]. 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 81912bef..b57a8261 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 @@ -28,6 +28,7 @@ import com.withorb.api.models.EventBackfillListParams import com.withorb.api.models.EventBackfillRevertParams import com.withorb.api.models.EventBackfillRevertResponse import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class BackfillServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : @@ -39,6 +40,9 @@ class BackfillServiceAsyncImpl internal constructor(private val clientOptions: C override fun withRawResponse(): BackfillServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): BackfillServiceAsync = + BackfillServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: EventBackfillCreateParams, requestOptions: RequestOptions, @@ -79,6 +83,13 @@ class BackfillServiceAsyncImpl internal constructor(private val clientOptions: C private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): BackfillServiceAsync.WithRawResponse = + BackfillServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -90,6 +101,7 @@ class BackfillServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "backfills") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -121,6 +133,7 @@ class BackfillServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "backfills") .build() .prepareAsync(clientOptions, params) @@ -162,6 +175,7 @@ class BackfillServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "backfills", params._pathParam(0), "close") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -196,6 +210,7 @@ class BackfillServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "backfills", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) @@ -229,6 +244,7 @@ class BackfillServiceAsyncImpl internal constructor(private val clientOptions: C val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "backfills", params._pathParam(0), "revert") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() 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 8a938c65..928b18c1 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 @@ -2,11 +2,13 @@ package com.withorb.api.services.async.events +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.EventVolumeListParams import com.withorb.api.models.EventVolumes import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface VolumeServiceAsync { @@ -15,6 +17,13 @@ interface VolumeServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): VolumeServiceAsync + /** * This endpoint returns the event volume for an account in a * [paginated list format](/api-reference/pagination). @@ -42,6 +51,15 @@ interface VolumeServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): VolumeServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `get /events/volume`, but is otherwise the same as * [VolumeServiceAsync.list]. 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 9ffce57f..41c564ff 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 @@ -17,6 +17,7 @@ import com.withorb.api.core.prepareAsync import com.withorb.api.models.EventVolumeListParams import com.withorb.api.models.EventVolumes import java.util.concurrent.CompletableFuture +import java.util.function.Consumer class VolumeServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : VolumeServiceAsync { @@ -27,6 +28,9 @@ class VolumeServiceAsyncImpl internal constructor(private val clientOptions: Cli override fun withRawResponse(): VolumeServiceAsync.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): VolumeServiceAsync = + VolumeServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun list( params: EventVolumeListParams, requestOptions: RequestOptions, @@ -39,6 +43,13 @@ class VolumeServiceAsyncImpl internal constructor(private val clientOptions: Cli private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): VolumeServiceAsync.WithRawResponse = + VolumeServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -49,6 +60,7 @@ class VolumeServiceAsyncImpl internal constructor(private val clientOptions: Cli val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "volume") .build() .prepareAsync(clientOptions, params) 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 1e004486..1aa504ea 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 @@ -2,12 +2,14 @@ package com.withorb.api.services.async.plans +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Plan import com.withorb.api.models.PlanExternalPlanIdFetchParams import com.withorb.api.models.PlanExternalPlanIdUpdateParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface ExternalPlanIdServiceAsync { @@ -16,6 +18,13 @@ interface ExternalPlanIdServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ExternalPlanIdServiceAsync + /** * This endpoint can be used to update the `external_plan_id`, and `metadata` of an existing * plan. @@ -110,6 +119,15 @@ interface ExternalPlanIdServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ExternalPlanIdServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `put /plans/external_plan_id/{external_plan_id}`, but is * otherwise the same as [ExternalPlanIdServiceAsync.update]. 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 ca1c846f..50d7525a 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 @@ -20,6 +20,7 @@ import com.withorb.api.models.Plan import com.withorb.api.models.PlanExternalPlanIdFetchParams import com.withorb.api.models.PlanExternalPlanIdUpdateParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class ExternalPlanIdServiceAsyncImpl @@ -31,6 +32,11 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdS override fun withRawResponse(): ExternalPlanIdServiceAsync.WithRawResponse = withRawResponse + override fun withOptions( + modifier: Consumer + ): ExternalPlanIdServiceAsync = + ExternalPlanIdServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun update( params: PlanExternalPlanIdUpdateParams, requestOptions: RequestOptions, @@ -50,6 +56,13 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdS private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): ExternalPlanIdServiceAsync.WithRawResponse = + ExternalPlanIdServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -63,6 +76,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdS val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", "external_plan_id", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -96,6 +110,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPlanIdS val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", "external_plan_id", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) 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 5b94080c..a16ac073 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 @@ -2,12 +2,14 @@ package com.withorb.api.services.async.prices +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Price import com.withorb.api.models.PriceExternalPriceIdFetchParams import com.withorb.api.models.PriceExternalPriceIdUpdateParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer interface ExternalPriceIdServiceAsync { @@ -16,6 +18,13 @@ interface ExternalPriceIdServiceAsync { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ExternalPriceIdServiceAsync + /** * This endpoint allows you to update the `metadata` property on a price. If you pass null for * the metadata value, it will clear any existing metadata for that price. @@ -93,6 +102,15 @@ interface ExternalPriceIdServiceAsync { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ExternalPriceIdServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `put /prices/external_price_id/{external_price_id}`, but * is otherwise the same as [ExternalPriceIdServiceAsync.update]. 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 da2d7057..6384a65a 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 @@ -20,6 +20,7 @@ import com.withorb.api.models.Price import com.withorb.api.models.PriceExternalPriceIdFetchParams import com.withorb.api.models.PriceExternalPriceIdUpdateParams import java.util.concurrent.CompletableFuture +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class ExternalPriceIdServiceAsyncImpl @@ -31,6 +32,11 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPriceId override fun withRawResponse(): ExternalPriceIdServiceAsync.WithRawResponse = withRawResponse + override fun withOptions( + modifier: Consumer + ): ExternalPriceIdServiceAsync = + ExternalPriceIdServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun update( params: PriceExternalPriceIdUpdateParams, requestOptions: RequestOptions, @@ -50,6 +56,13 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPriceId private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): ExternalPriceIdServiceAsync.WithRawResponse = + ExternalPriceIdServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -63,6 +76,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPriceId val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", "external_price_id", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -96,6 +110,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPriceId val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", "external_price_id", params._pathParam(0)) .build() .prepareAsync(clientOptions, params) 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 8d4a2b0f..db684a61 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Alert @@ -15,6 +16,7 @@ import com.withorb.api.models.AlertListPage import com.withorb.api.models.AlertListParams import com.withorb.api.models.AlertRetrieveParams import com.withorb.api.models.AlertUpdateParams +import java.util.function.Consumer interface AlertService { @@ -23,6 +25,13 @@ interface AlertService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): AlertService + /** This endpoint retrieves an alert by its ID. */ fun retrieve(alertId: String): Alert = retrieve(alertId, AlertRetrieveParams.none()) @@ -280,6 +289,13 @@ interface AlertService { /** A view of [AlertService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): AlertService.WithRawResponse + /** * Returns a raw HTTP response for `get /alerts/{alert_id}`, but is otherwise the same as * [AlertService.retrieve]. 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 c3c729de..5911e5a4 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 @@ -27,6 +27,7 @@ import com.withorb.api.models.AlertListPageResponse import com.withorb.api.models.AlertListParams import com.withorb.api.models.AlertRetrieveParams import com.withorb.api.models.AlertUpdateParams +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class AlertServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -38,6 +39,9 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt override fun withRawResponse(): AlertService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): AlertService = + AlertServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun retrieve(params: AlertRetrieveParams, requestOptions: RequestOptions): Alert = // get /alerts/{alert_id} withRawResponse().retrieve(params, requestOptions).parse() @@ -84,6 +88,13 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): AlertService.WithRawResponse = + AlertServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -97,6 +108,7 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", params._pathParam(0)) .build() .prepare(clientOptions, params) @@ -126,6 +138,7 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -154,6 +167,7 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts") .build() .prepare(clientOptions, params) @@ -190,6 +204,7 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", "customer_id", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -220,6 +235,7 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", "external_customer_id", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -250,6 +266,7 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", "subscription_id", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -280,6 +297,7 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", params._pathParam(0), "disable") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -310,6 +328,7 @@ class AlertServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("alerts", params._pathParam(0), "enable") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/BetaService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/BetaService.kt index e40d8adb..9ac9ebfc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/BetaService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/BetaService.kt @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.BetaCreatePlanVersionParams @@ -11,6 +12,7 @@ import com.withorb.api.models.BetaSetDefaultPlanVersionParams import com.withorb.api.models.Plan import com.withorb.api.models.PlanVersion import com.withorb.api.services.blocking.beta.ExternalPlanIdService +import java.util.function.Consumer interface BetaService { @@ -19,6 +21,13 @@ interface BetaService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): BetaService + fun externalPlanId(): ExternalPlanIdService /** @@ -103,6 +112,13 @@ interface BetaService { /** A view of [BetaService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): BetaService.WithRawResponse + fun externalPlanId(): ExternalPlanIdService.WithRawResponse /** diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/BetaServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/BetaServiceImpl.kt index bcbe2611..d59eab2a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/BetaServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/BetaServiceImpl.kt @@ -23,6 +23,7 @@ import com.withorb.api.models.Plan import com.withorb.api.models.PlanVersion import com.withorb.api.services.blocking.beta.ExternalPlanIdService import com.withorb.api.services.blocking.beta.ExternalPlanIdServiceImpl +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class BetaServiceImpl internal constructor(private val clientOptions: ClientOptions) : BetaService { @@ -37,6 +38,9 @@ class BetaServiceImpl internal constructor(private val clientOptions: ClientOpti override fun withRawResponse(): BetaService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): BetaService = + BetaServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun externalPlanId(): ExternalPlanIdService = externalPlanId override fun createPlanVersion( @@ -69,6 +73,13 @@ class BetaServiceImpl internal constructor(private val clientOptions: ClientOpti ExternalPlanIdServiceImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): BetaService.WithRawResponse = + BetaServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun externalPlanId(): ExternalPlanIdService.WithRawResponse = externalPlanId private val createPlanVersionHandler: Handler = @@ -84,6 +95,7 @@ class BetaServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", params._pathParam(0), "versions") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -114,6 +126,7 @@ class BetaServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "plans", params._pathParam(0), @@ -148,6 +161,7 @@ class BetaServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", params._pathParam(0), "set_default_version") .body(json(clientOptions.jsonMapper, params._body())) .build() 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 e3c3e65e..336beba4 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Coupon @@ -12,6 +13,7 @@ import com.withorb.api.models.CouponFetchParams import com.withorb.api.models.CouponListPage import com.withorb.api.models.CouponListParams import com.withorb.api.services.blocking.coupons.SubscriptionService +import java.util.function.Consumer interface CouponService { @@ -20,6 +22,13 @@ interface CouponService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CouponService + fun subscriptions(): SubscriptionService /** @@ -124,6 +133,13 @@ interface CouponService { /** A view of [CouponService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CouponService.WithRawResponse + fun subscriptions(): SubscriptionService.WithRawResponse /** 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 5d27644d..002a99a7 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 @@ -25,6 +25,7 @@ import com.withorb.api.models.CouponListPageResponse import com.withorb.api.models.CouponListParams import com.withorb.api.services.blocking.coupons.SubscriptionService import com.withorb.api.services.blocking.coupons.SubscriptionServiceImpl +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class CouponServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -40,6 +41,9 @@ class CouponServiceImpl internal constructor(private val clientOptions: ClientOp override fun withRawResponse(): CouponService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): CouponService = + CouponServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun subscriptions(): SubscriptionService = subscriptions override fun create(params: CouponCreateParams, requestOptions: RequestOptions): Coupon = @@ -67,6 +71,13 @@ class CouponServiceImpl internal constructor(private val clientOptions: ClientOp SubscriptionServiceImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): CouponService.WithRawResponse = + CouponServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun subscriptions(): SubscriptionService.WithRawResponse = subscriptions private val createHandler: Handler = @@ -79,6 +90,7 @@ class CouponServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("coupons") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -107,6 +119,7 @@ class CouponServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("coupons") .build() .prepare(clientOptions, params) @@ -143,6 +156,7 @@ class CouponServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("coupons", params._pathParam(0), "archive") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -173,6 +187,7 @@ class CouponServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("coupons", params._pathParam(0)) .build() .prepare(clientOptions, params) 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 972aaf76..79147cec 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.CreditNote @@ -10,6 +11,7 @@ import com.withorb.api.models.CreditNoteCreateParams import com.withorb.api.models.CreditNoteFetchParams import com.withorb.api.models.CreditNoteListPage import com.withorb.api.models.CreditNoteListParams +import java.util.function.Consumer interface CreditNoteService { @@ -18,6 +20,13 @@ interface CreditNoteService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CreditNoteService + /** This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). */ fun create(params: CreditNoteCreateParams): CreditNote = create(params, RequestOptions.none()) @@ -83,6 +92,15 @@ interface CreditNoteService { /** A view of [CreditNoteService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): CreditNoteService.WithRawResponse + /** * Returns a raw HTTP response for `post /credit_notes`, but is otherwise the same as * [CreditNoteService.create]. 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 883d149a..cf6e0f8f 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 @@ -22,6 +22,7 @@ import com.withorb.api.models.CreditNoteFetchParams import com.withorb.api.models.CreditNoteListPage import com.withorb.api.models.CreditNoteListPageResponse import com.withorb.api.models.CreditNoteListParams +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class CreditNoteServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -33,6 +34,9 @@ class CreditNoteServiceImpl internal constructor(private val clientOptions: Clie override fun withRawResponse(): CreditNoteService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): CreditNoteService = + CreditNoteServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: CreditNoteCreateParams, requestOptions: RequestOptions, @@ -56,6 +60,13 @@ class CreditNoteServiceImpl internal constructor(private val clientOptions: Clie private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): CreditNoteService.WithRawResponse = + CreditNoteServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -66,6 +77,7 @@ class CreditNoteServiceImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("credit_notes") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -94,6 +106,7 @@ class CreditNoteServiceImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("credit_notes") .build() .prepare(clientOptions, params) @@ -130,6 +143,7 @@ class CreditNoteServiceImpl internal constructor(private val clientOptions: Clie val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("credit_notes", params._pathParam(0)) .build() .prepare(clientOptions, params) 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 1d4f2a52..814ec983 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponse import com.withorb.api.core.http.HttpResponseFor @@ -20,6 +21,7 @@ import com.withorb.api.models.CustomerUpdateParams import com.withorb.api.services.blocking.customers.BalanceTransactionService import com.withorb.api.services.blocking.customers.CostService import com.withorb.api.services.blocking.customers.CreditService +import java.util.function.Consumer interface CustomerService { @@ -28,6 +30,13 @@ interface CustomerService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CustomerService + fun costs(): CostService fun credits(): CreditService @@ -376,6 +385,13 @@ interface CustomerService { /** A view of [CustomerService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CustomerService.WithRawResponse + fun costs(): CostService.WithRawResponse fun credits(): CreditService.WithRawResponse 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 06e16345..b36c08c8 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 @@ -36,6 +36,7 @@ import com.withorb.api.services.blocking.customers.CostService import com.withorb.api.services.blocking.customers.CostServiceImpl import com.withorb.api.services.blocking.customers.CreditService import com.withorb.api.services.blocking.customers.CreditServiceImpl +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class CustomerServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -55,6 +56,9 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client override fun withRawResponse(): CustomerService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): CustomerService = + CustomerServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun costs(): CostService = costs override fun credits(): CreditService = credits @@ -133,6 +137,13 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client BalanceTransactionServiceImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): CustomerService.WithRawResponse = + CustomerServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun costs(): CostService.WithRawResponse = costs override fun credits(): CreditService.WithRawResponse = credits @@ -150,6 +161,7 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -180,6 +192,7 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -208,6 +221,7 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers") .build() .prepare(clientOptions, params) @@ -243,6 +257,7 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0)) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -265,6 +280,7 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0)) .build() .prepare(clientOptions, params) @@ -294,6 +310,7 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", "external_customer_id", params._pathParam(0)) .build() .prepare(clientOptions, params) @@ -323,6 +340,7 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", params._pathParam(0), @@ -351,6 +369,7 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", @@ -380,6 +399,7 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", "external_customer_id", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() 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 8213acc2..5089a753 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.DimensionalPriceGroup @@ -11,6 +12,7 @@ import com.withorb.api.models.DimensionalPriceGroupListPage import com.withorb.api.models.DimensionalPriceGroupListParams import com.withorb.api.models.DimensionalPriceGroupRetrieveParams import com.withorb.api.services.blocking.dimensionalPriceGroups.ExternalDimensionalPriceGroupIdService +import java.util.function.Consumer interface DimensionalPriceGroupService { @@ -19,6 +21,13 @@ interface DimensionalPriceGroupService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): DimensionalPriceGroupService + fun externalDimensionalPriceGroupId(): ExternalDimensionalPriceGroupIdService /** @@ -105,6 +114,15 @@ interface DimensionalPriceGroupService { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): DimensionalPriceGroupService.WithRawResponse + fun externalDimensionalPriceGroupId(): ExternalDimensionalPriceGroupIdService.WithRawResponse 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 7f600f1d..4646747d 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 @@ -24,6 +24,7 @@ import com.withorb.api.models.DimensionalPriceGroupRetrieveParams import com.withorb.api.models.DimensionalPriceGroups import com.withorb.api.services.blocking.dimensionalPriceGroups.ExternalDimensionalPriceGroupIdService import com.withorb.api.services.blocking.dimensionalPriceGroups.ExternalDimensionalPriceGroupIdServiceImpl +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class DimensionalPriceGroupServiceImpl @@ -39,6 +40,11 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric override fun withRawResponse(): DimensionalPriceGroupService.WithRawResponse = withRawResponse + override fun withOptions( + modifier: Consumer + ): DimensionalPriceGroupService = + DimensionalPriceGroupServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun externalDimensionalPriceGroupId(): ExternalDimensionalPriceGroupIdService = externalDimensionalPriceGroupId @@ -73,6 +79,13 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric ExternalDimensionalPriceGroupIdServiceImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): DimensionalPriceGroupService.WithRawResponse = + DimensionalPriceGroupServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun externalDimensionalPriceGroupId(): ExternalDimensionalPriceGroupIdService.WithRawResponse = externalDimensionalPriceGroupId @@ -87,6 +100,7 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("dimensional_price_groups") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -118,6 +132,7 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("dimensional_price_groups", params._pathParam(0)) .build() .prepare(clientOptions, params) @@ -145,6 +160,7 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("dimensional_price_groups") .build() .prepare(clientOptions, params) 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 432a8d3a..2666af73 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.EventDeprecateParams @@ -15,6 +16,7 @@ import com.withorb.api.models.EventUpdateParams import com.withorb.api.models.EventUpdateResponse import com.withorb.api.services.blocking.events.BackfillService import com.withorb.api.services.blocking.events.VolumeService +import java.util.function.Consumer interface EventService { @@ -23,6 +25,13 @@ interface EventService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): EventService + fun backfills(): BackfillService fun volume(): VolumeService @@ -383,6 +392,13 @@ interface EventService { /** A view of [EventService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): EventService.WithRawResponse + fun backfills(): BackfillService.WithRawResponse fun volume(): VolumeService.WithRawResponse 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 7c3bb7c3..9ef46bde 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 @@ -28,6 +28,7 @@ import com.withorb.api.services.blocking.events.BackfillService import com.withorb.api.services.blocking.events.BackfillServiceImpl import com.withorb.api.services.blocking.events.VolumeService import com.withorb.api.services.blocking.events.VolumeServiceImpl +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class EventServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -43,6 +44,9 @@ class EventServiceImpl internal constructor(private val clientOptions: ClientOpt override fun withRawResponse(): EventService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): EventService = + EventServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun backfills(): BackfillService = backfills override fun volume(): VolumeService = volume @@ -88,6 +92,13 @@ class EventServiceImpl internal constructor(private val clientOptions: ClientOpt VolumeServiceImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): EventService.WithRawResponse = + EventServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun backfills(): BackfillService.WithRawResponse = backfills override fun volume(): VolumeService.WithRawResponse = volume @@ -106,6 +117,7 @@ class EventServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -137,6 +149,7 @@ class EventServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", params._pathParam(0), "deprecate") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -165,6 +178,7 @@ class EventServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("ingest") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -193,6 +207,7 @@ class EventServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "search") .body(json(clientOptions.jsonMapper, params._body())) .build() 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 c85d74a0..3940b943 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 @@ -3,10 +3,12 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.InvoiceLineItemCreateParams import com.withorb.api.models.InvoiceLineItemCreateResponse +import java.util.function.Consumer interface InvoiceLineItemService { @@ -15,6 +17,13 @@ interface InvoiceLineItemService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): InvoiceLineItemService + /** * This creates a one-off fixed fee invoice line item on an Invoice. This can only be done for * invoices that are in a `draft` status. @@ -34,6 +43,15 @@ interface InvoiceLineItemService { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): InvoiceLineItemService.WithRawResponse + /** * Returns a raw HTTP response for `post /invoice_line_items`, but is otherwise the same as * [InvoiceLineItemService.create]. 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 03eeb98c..00876f35 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 @@ -17,6 +17,7 @@ import com.withorb.api.core.http.parseable import com.withorb.api.core.prepare import com.withorb.api.models.InvoiceLineItemCreateParams import com.withorb.api.models.InvoiceLineItemCreateResponse +import java.util.function.Consumer class InvoiceLineItemServiceImpl internal constructor(private val clientOptions: ClientOptions) : InvoiceLineItemService { @@ -27,6 +28,9 @@ class InvoiceLineItemServiceImpl internal constructor(private val clientOptions: override fun withRawResponse(): InvoiceLineItemService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): InvoiceLineItemService = + InvoiceLineItemServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: InvoiceLineItemCreateParams, requestOptions: RequestOptions, @@ -39,6 +43,13 @@ class InvoiceLineItemServiceImpl internal constructor(private val clientOptions: private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): InvoiceLineItemService.WithRawResponse = + InvoiceLineItemServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -50,6 +61,7 @@ class InvoiceLineItemServiceImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoice_line_items") .body(json(clientOptions.jsonMapper, params._body())) .build() 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 ff6d4926..b160cdb3 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Invoice @@ -17,6 +18,7 @@ import com.withorb.api.models.InvoiceMarkPaidParams import com.withorb.api.models.InvoicePayParams import com.withorb.api.models.InvoiceUpdateParams import com.withorb.api.models.InvoiceVoidInvoiceParams +import java.util.function.Consumer interface InvoiceService { @@ -25,6 +27,13 @@ interface InvoiceService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): InvoiceService + /** This endpoint is used to create a one-off invoice for a customer. */ fun create(params: InvoiceCreateParams): Invoice = create(params, RequestOptions.none()) @@ -271,6 +280,13 @@ interface InvoiceService { /** A view of [InvoiceService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): InvoiceService.WithRawResponse + /** * Returns a raw HTTP response for `post /invoices`, but is otherwise the same as * [InvoiceService.create]. 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 54c0dc6c..1a760a81 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 @@ -29,6 +29,7 @@ import com.withorb.api.models.InvoiceMarkPaidParams import com.withorb.api.models.InvoicePayParams import com.withorb.api.models.InvoiceUpdateParams import com.withorb.api.models.InvoiceVoidInvoiceParams +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class InvoiceServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -40,6 +41,9 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO override fun withRawResponse(): InvoiceService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): InvoiceService = + InvoiceServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create(params: InvoiceCreateParams, requestOptions: RequestOptions): Invoice = // post /invoices withRawResponse().create(params, requestOptions).parse() @@ -87,6 +91,13 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): InvoiceService.WithRawResponse = + InvoiceServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -97,6 +108,7 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -127,6 +139,7 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -155,6 +168,7 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices") .build() .prepare(clientOptions, params) @@ -191,6 +205,7 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", params._pathParam(0)) .build() .prepare(clientOptions, params) @@ -218,6 +233,7 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", "upcoming") .build() .prepare(clientOptions, params) @@ -247,6 +263,7 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", params._pathParam(0), "issue") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -277,6 +294,7 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", params._pathParam(0), "mark_paid") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -307,6 +325,7 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", params._pathParam(0), "pay") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -337,6 +356,7 @@ class InvoiceServiceImpl internal constructor(private val clientOptions: ClientO val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("invoices", params._pathParam(0), "void") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() 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 a1863908..57f466f6 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Item @@ -12,6 +13,7 @@ import com.withorb.api.models.ItemFetchParams import com.withorb.api.models.ItemListPage import com.withorb.api.models.ItemListParams import com.withorb.api.models.ItemUpdateParams +import java.util.function.Consumer interface ItemService { @@ -20,6 +22,13 @@ interface ItemService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ItemService + /** This endpoint is used to create an [Item](/core-concepts#item). */ fun create(params: ItemCreateParams): Item = create(params, RequestOptions.none()) @@ -127,6 +136,13 @@ interface ItemService { /** A view of [ItemService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ItemService.WithRawResponse + /** * Returns a raw HTTP response for `post /items`, but is otherwise the same as * [ItemService.create]. 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 3a93218b..5adb0fa9 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 @@ -24,6 +24,7 @@ import com.withorb.api.models.ItemListPage import com.withorb.api.models.ItemListPageResponse import com.withorb.api.models.ItemListParams import com.withorb.api.models.ItemUpdateParams +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class ItemServiceImpl internal constructor(private val clientOptions: ClientOptions) : ItemService { @@ -34,6 +35,9 @@ class ItemServiceImpl internal constructor(private val clientOptions: ClientOpti override fun withRawResponse(): ItemService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): ItemService = + ItemServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create(params: ItemCreateParams, requestOptions: RequestOptions): Item = // post /items withRawResponse().create(params, requestOptions).parse() @@ -59,6 +63,13 @@ class ItemServiceImpl internal constructor(private val clientOptions: ClientOpti private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): ItemService.WithRawResponse = + ItemServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -69,6 +80,7 @@ class ItemServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("items") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -99,6 +111,7 @@ class ItemServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("items", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -127,6 +140,7 @@ class ItemServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("items") .build() .prepare(clientOptions, params) @@ -163,6 +177,7 @@ class ItemServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("items", params._pathParam(0), "archive") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -193,6 +208,7 @@ class ItemServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("items", params._pathParam(0)) .build() .prepare(clientOptions, params) 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 9c207ddb..89adc779 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.BillableMetric @@ -11,6 +12,7 @@ import com.withorb.api.models.MetricFetchParams import com.withorb.api.models.MetricListPage import com.withorb.api.models.MetricListParams import com.withorb.api.models.MetricUpdateParams +import java.util.function.Consumer interface MetricService { @@ -19,6 +21,13 @@ interface MetricService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): MetricService + /** * This endpoint is used to create a [metric](/core-concepts###metric) using a SQL string. See * [SQL support](/extensibility/advanced-metrics#sql-support) for a description of constructing @@ -120,6 +129,13 @@ interface MetricService { /** A view of [MetricService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): MetricService.WithRawResponse + /** * Returns a raw HTTP response for `post /metrics`, but is otherwise the same as * [MetricService.create]. 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 94d03141..9acb7537 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 @@ -23,6 +23,7 @@ import com.withorb.api.models.MetricListPage import com.withorb.api.models.MetricListPageResponse import com.withorb.api.models.MetricListParams import com.withorb.api.models.MetricUpdateParams +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class MetricServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -34,6 +35,9 @@ class MetricServiceImpl internal constructor(private val clientOptions: ClientOp override fun withRawResponse(): MetricService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): MetricService = + MetricServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: MetricCreateParams, requestOptions: RequestOptions, @@ -61,6 +65,13 @@ class MetricServiceImpl internal constructor(private val clientOptions: ClientOp private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): MetricService.WithRawResponse = + MetricServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -71,6 +82,7 @@ class MetricServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("metrics") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -101,6 +113,7 @@ class MetricServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("metrics", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -129,6 +142,7 @@ class MetricServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("metrics") .build() .prepare(clientOptions, params) @@ -165,6 +179,7 @@ class MetricServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("metrics", params._pathParam(0)) .build() .prepare(clientOptions, params) 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 78a97e1e..a361bcde 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Plan @@ -12,6 +13,7 @@ import com.withorb.api.models.PlanListPage import com.withorb.api.models.PlanListParams import com.withorb.api.models.PlanUpdateParams import com.withorb.api.services.blocking.plans.ExternalPlanIdService +import java.util.function.Consumer interface PlanService { @@ -20,6 +22,13 @@ interface PlanService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): PlanService + fun externalPlanId(): ExternalPlanIdService /** This endpoint allows creation of plans including their prices. */ @@ -129,6 +138,13 @@ interface PlanService { /** A view of [PlanService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): PlanService.WithRawResponse + fun externalPlanId(): ExternalPlanIdService.WithRawResponse /** 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 ed66bd0c..856d66d4 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 @@ -25,6 +25,7 @@ import com.withorb.api.models.PlanListParams import com.withorb.api.models.PlanUpdateParams import com.withorb.api.services.blocking.plans.ExternalPlanIdService import com.withorb.api.services.blocking.plans.ExternalPlanIdServiceImpl +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class PlanServiceImpl internal constructor(private val clientOptions: ClientOptions) : PlanService { @@ -39,6 +40,9 @@ class PlanServiceImpl internal constructor(private val clientOptions: ClientOpti override fun withRawResponse(): PlanService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): PlanService = + PlanServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun externalPlanId(): ExternalPlanIdService = externalPlanId override fun create(params: PlanCreateParams, requestOptions: RequestOptions): Plan = @@ -66,6 +70,13 @@ class PlanServiceImpl internal constructor(private val clientOptions: ClientOpti ExternalPlanIdServiceImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): PlanService.WithRawResponse = + PlanServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun externalPlanId(): ExternalPlanIdService.WithRawResponse = externalPlanId private val createHandler: Handler = @@ -78,6 +89,7 @@ class PlanServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -108,6 +120,7 @@ class PlanServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -136,6 +149,7 @@ class PlanServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans") .build() .prepare(clientOptions, params) @@ -172,6 +186,7 @@ class PlanServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", params._pathParam(0)) .build() .prepare(clientOptions, params) 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 14f6a254..7e98683e 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Price @@ -18,6 +19,7 @@ import com.withorb.api.models.PriceListPage import com.withorb.api.models.PriceListParams import com.withorb.api.models.PriceUpdateParams import com.withorb.api.services.blocking.prices.ExternalPriceIdService +import java.util.function.Consumer interface PriceService { @@ -26,6 +28,13 @@ interface PriceService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): PriceService + fun externalPriceId(): ExternalPriceIdService /** @@ -232,6 +241,13 @@ interface PriceService { /** A view of [PriceService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): PriceService.WithRawResponse + fun externalPriceId(): ExternalPriceIdService.WithRawResponse /** 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 59a071a7..53dfa4dd 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 @@ -31,6 +31,7 @@ import com.withorb.api.models.PriceListParams import com.withorb.api.models.PriceUpdateParams import com.withorb.api.services.blocking.prices.ExternalPriceIdService import com.withorb.api.services.blocking.prices.ExternalPriceIdServiceImpl +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class PriceServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -46,6 +47,9 @@ class PriceServiceImpl internal constructor(private val clientOptions: ClientOpt override fun withRawResponse(): PriceService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): PriceService = + PriceServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun externalPriceId(): ExternalPriceIdService = externalPriceId override fun create(params: PriceCreateParams, requestOptions: RequestOptions): Price = @@ -94,6 +98,13 @@ class PriceServiceImpl internal constructor(private val clientOptions: ClientOpt ExternalPriceIdServiceImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): PriceService.WithRawResponse = + PriceServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun externalPriceId(): ExternalPriceIdService.WithRawResponse = externalPriceId private val createHandler: Handler = @@ -106,6 +117,7 @@ class PriceServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -136,6 +148,7 @@ class PriceServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -164,6 +177,7 @@ class PriceServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices") .build() .prepare(clientOptions, params) @@ -201,6 +215,7 @@ class PriceServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", params._pathParam(0), "evaluate") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -229,6 +244,7 @@ class PriceServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", "evaluate") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -257,6 +273,7 @@ class PriceServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", "evaluate_preview_events") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -287,6 +304,7 @@ class PriceServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", params._pathParam(0)) .build() .prepare(clientOptions, params) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeService.kt index 42a2deff..55908a18 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeService.kt @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.SubscriptionChangeApplyParams @@ -11,6 +12,7 @@ import com.withorb.api.models.SubscriptionChangeCancelParams import com.withorb.api.models.SubscriptionChangeCancelResponse import com.withorb.api.models.SubscriptionChangeRetrieveParams import com.withorb.api.models.SubscriptionChangeRetrieveResponse +import java.util.function.Consumer interface SubscriptionChangeService { @@ -19,6 +21,13 @@ interface SubscriptionChangeService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SubscriptionChangeService + /** * This endpoint returns a subscription change given an identifier. * @@ -155,6 +164,15 @@ interface SubscriptionChangeService { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): SubscriptionChangeService.WithRawResponse + /** * Returns a raw HTTP response for `get /subscription_changes/{subscription_change_id}`, but * is otherwise the same as [SubscriptionChangeService.retrieve]. diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceImpl.kt index b103be4a..56338b4e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceImpl.kt @@ -22,6 +22,7 @@ import com.withorb.api.models.SubscriptionChangeCancelParams import com.withorb.api.models.SubscriptionChangeCancelResponse import com.withorb.api.models.SubscriptionChangeRetrieveParams import com.withorb.api.models.SubscriptionChangeRetrieveResponse +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class SubscriptionChangeServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -33,6 +34,9 @@ class SubscriptionChangeServiceImpl internal constructor(private val clientOptio override fun withRawResponse(): SubscriptionChangeService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): SubscriptionChangeService = + SubscriptionChangeServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun retrieve( params: SubscriptionChangeRetrieveParams, requestOptions: RequestOptions, @@ -59,6 +63,13 @@ class SubscriptionChangeServiceImpl internal constructor(private val clientOptio private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): SubscriptionChangeService.WithRawResponse = + SubscriptionChangeServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -73,6 +84,7 @@ class SubscriptionChangeServiceImpl internal constructor(private val clientOptio val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscription_changes", params._pathParam(0)) .build() .prepare(clientOptions, params) @@ -103,6 +115,7 @@ class SubscriptionChangeServiceImpl internal constructor(private val clientOptio val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscription_changes", params._pathParam(0), "apply") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -134,6 +147,7 @@ class SubscriptionChangeServiceImpl internal constructor(private val clientOptio val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscription_changes", params._pathParam(0), "cancel") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() 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 557a6c0e..9afef8c4 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.MutatedSubscription @@ -28,6 +29,7 @@ import com.withorb.api.models.SubscriptionUpdateFixedFeeQuantityParams import com.withorb.api.models.SubscriptionUpdateParams import com.withorb.api.models.SubscriptionUpdateTrialParams import com.withorb.api.models.SubscriptionUsage +import java.util.function.Consumer interface SubscriptionService { @@ -36,6 +38,13 @@ interface SubscriptionService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SubscriptionService + /** * A subscription represents the purchase of a plan by a customer. The customer is identified by * either the `customer_id` or the `external_customer_id`, and exactly one of these fields must @@ -1327,6 +1336,15 @@ interface SubscriptionService { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): SubscriptionService.WithRawResponse + /** * Returns a raw HTTP response for `post /subscriptions`, but is otherwise the same as * [SubscriptionService.create]. 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 d52e2ee9..d01765c2 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 @@ -41,6 +41,7 @@ import com.withorb.api.models.SubscriptionUpdateParams import com.withorb.api.models.SubscriptionUpdateTrialParams import com.withorb.api.models.SubscriptionUsage import com.withorb.api.models.Subscriptions +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class SubscriptionServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -52,6 +53,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl override fun withRawResponse(): SubscriptionService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): SubscriptionService = + SubscriptionServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: SubscriptionCreateParams, requestOptions: RequestOptions, @@ -176,6 +180,13 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): SubscriptionService.WithRawResponse = + SubscriptionServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -187,6 +198,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -217,6 +229,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -244,6 +257,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions") .build() .prepare(clientOptions, params) @@ -281,6 +295,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "cancel") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -311,6 +326,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0)) .build() .prepare(clientOptions, params) @@ -341,6 +357,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "costs") .build() .prepare(clientOptions, params) @@ -371,6 +388,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "schedule") .build() .prepare(clientOptions, params) @@ -407,6 +425,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "usage") .build() .prepare(clientOptions, params) @@ -437,6 +456,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "price_intervals") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -468,6 +488,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "redeem_coupon") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -499,6 +520,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "schedule_plan_change") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -530,6 +552,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "trigger_phase") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -561,6 +584,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "subscriptions", params._pathParam(0), @@ -596,6 +620,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "subscriptions", params._pathParam(0), @@ -631,6 +656,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "subscriptions", params._pathParam(0), @@ -666,6 +692,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "subscriptions", params._pathParam(0), @@ -701,6 +728,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("subscriptions", params._pathParam(0), "update_trial") .body(json(clientOptions.jsonMapper, params._body())) .build() 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 ce992e00..6f0a99fb 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 @@ -3,10 +3,12 @@ package com.withorb.api.services.blocking import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.TopLevelPingParams import com.withorb.api.models.TopLevelPingResponse +import java.util.function.Consumer interface TopLevelService { @@ -15,6 +17,13 @@ interface TopLevelService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): TopLevelService + /** * This endpoint allows you to test your connection to the Orb API and check the validity of * your API key, passed in the Authorization header. This is particularly useful for checking @@ -42,6 +51,13 @@ interface TopLevelService { /** A view of [TopLevelService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): TopLevelService.WithRawResponse + /** * Returns a raw HTTP response for `get /ping`, but is otherwise the same as * [TopLevelService.ping]. 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 cfabafd8..4777c1da 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 @@ -16,6 +16,7 @@ import com.withorb.api.core.http.parseable import com.withorb.api.core.prepare import com.withorb.api.models.TopLevelPingParams import com.withorb.api.models.TopLevelPingResponse +import java.util.function.Consumer class TopLevelServiceImpl internal constructor(private val clientOptions: ClientOptions) : TopLevelService { @@ -26,6 +27,9 @@ class TopLevelServiceImpl internal constructor(private val clientOptions: Client override fun withRawResponse(): TopLevelService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): TopLevelService = + TopLevelServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun ping( params: TopLevelPingParams, requestOptions: RequestOptions, @@ -38,6 +42,13 @@ class TopLevelServiceImpl internal constructor(private val clientOptions: Client private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): TopLevelService.WithRawResponse = + TopLevelServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val pingHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -49,6 +60,7 @@ class TopLevelServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("ping") .build() .prepare(clientOptions, params) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/beta/ExternalPlanIdService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/beta/ExternalPlanIdService.kt index cfdb050c..121e2e8f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/beta/ExternalPlanIdService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/beta/ExternalPlanIdService.kt @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking.beta import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.BetaExternalPlanIdCreatePlanVersionParams @@ -10,6 +11,7 @@ import com.withorb.api.models.BetaExternalPlanIdFetchPlanVersionParams import com.withorb.api.models.BetaExternalPlanIdSetDefaultPlanVersionParams import com.withorb.api.models.Plan import com.withorb.api.models.PlanVersion +import java.util.function.Consumer interface ExternalPlanIdService { @@ -18,6 +20,13 @@ interface ExternalPlanIdService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ExternalPlanIdService + /** * This API endpoint is in beta and its interface may change. It is recommended for use only in * test mode. @@ -113,6 +122,15 @@ interface ExternalPlanIdService { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ExternalPlanIdService.WithRawResponse + /** * Returns a raw HTTP response for `post * /plans/external_plan_id/{external_plan_id}/versions`, but is otherwise the same as diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/beta/ExternalPlanIdServiceImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/beta/ExternalPlanIdServiceImpl.kt index b2c43808..b8a85300 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/beta/ExternalPlanIdServiceImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/beta/ExternalPlanIdServiceImpl.kt @@ -21,6 +21,7 @@ import com.withorb.api.models.BetaExternalPlanIdFetchPlanVersionParams import com.withorb.api.models.BetaExternalPlanIdSetDefaultPlanVersionParams import com.withorb.api.models.Plan import com.withorb.api.models.PlanVersion +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -32,6 +33,9 @@ class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: override fun withRawResponse(): ExternalPlanIdService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): ExternalPlanIdService = + ExternalPlanIdServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun createPlanVersion( params: BetaExternalPlanIdCreatePlanVersionParams, requestOptions: RequestOptions, @@ -58,6 +62,13 @@ class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): ExternalPlanIdService.WithRawResponse = + ExternalPlanIdServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createPlanVersionHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -71,6 +82,7 @@ class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", "external_plan_id", params._pathParam(0), "versions") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -101,6 +113,7 @@ class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "plans", "external_plan_id", @@ -136,6 +149,7 @@ class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "plans", "external_plan_id", 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 a387d181..26a7aac4 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 @@ -3,10 +3,12 @@ package com.withorb.api.services.blocking.coupons import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.CouponSubscriptionListPage import com.withorb.api.models.CouponSubscriptionListParams +import java.util.function.Consumer interface SubscriptionService { @@ -15,6 +17,13 @@ interface SubscriptionService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SubscriptionService + /** * This endpoint returns a list of all subscriptions that have redeemed a given coupon as a * [paginated](/api-reference/pagination) list, ordered starting from the most recently created @@ -57,6 +66,15 @@ interface SubscriptionService { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): SubscriptionService.WithRawResponse + /** * Returns a raw HTTP response for `get /coupons/{coupon_id}/subscriptions`, but is * otherwise the same as [SubscriptionService.list]. 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 0dea7d0a..cea270e5 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 @@ -18,6 +18,7 @@ import com.withorb.api.core.prepare import com.withorb.api.models.CouponSubscriptionListPage import com.withorb.api.models.CouponSubscriptionListParams import com.withorb.api.models.Subscriptions +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class SubscriptionServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -29,6 +30,9 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl override fun withRawResponse(): SubscriptionService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): SubscriptionService = + SubscriptionServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun list( params: CouponSubscriptionListParams, requestOptions: RequestOptions, @@ -41,6 +45,13 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): SubscriptionService.WithRawResponse = + SubscriptionServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -54,6 +65,7 @@ class SubscriptionServiceImpl internal constructor(private val clientOptions: Cl val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("coupons", params._pathParam(0), "subscriptions") .build() .prepare(clientOptions, params) 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 2e9356e0..8b812797 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 @@ -3,12 +3,14 @@ package com.withorb.api.services.blocking.customers import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.CustomerBalanceTransactionCreateParams import com.withorb.api.models.CustomerBalanceTransactionCreateResponse import com.withorb.api.models.CustomerBalanceTransactionListPage import com.withorb.api.models.CustomerBalanceTransactionListParams +import java.util.function.Consumer interface BalanceTransactionService { @@ -17,6 +19,13 @@ interface BalanceTransactionService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): BalanceTransactionService + /** * Creates an immutable balance transaction that updates the customer's balance and returns back * the newly created transaction. @@ -106,6 +115,15 @@ interface BalanceTransactionService { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): BalanceTransactionService.WithRawResponse + /** * Returns a raw HTTP response for `post /customers/{customer_id}/balance_transactions`, but * is otherwise the same as [BalanceTransactionService.create]. 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 ecca6166..d3619584 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 @@ -21,6 +21,7 @@ import com.withorb.api.models.CustomerBalanceTransactionCreateResponse import com.withorb.api.models.CustomerBalanceTransactionListPage import com.withorb.api.models.CustomerBalanceTransactionListPageResponse import com.withorb.api.models.CustomerBalanceTransactionListParams +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class BalanceTransactionServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -32,6 +33,9 @@ class BalanceTransactionServiceImpl internal constructor(private val clientOptio override fun withRawResponse(): BalanceTransactionService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): BalanceTransactionService = + BalanceTransactionServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: CustomerBalanceTransactionCreateParams, requestOptions: RequestOptions, @@ -51,6 +55,13 @@ class BalanceTransactionServiceImpl internal constructor(private val clientOptio private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): BalanceTransactionService.WithRawResponse = + BalanceTransactionServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -65,6 +76,7 @@ class BalanceTransactionServiceImpl internal constructor(private val clientOptio val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "balance_transactions") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -96,6 +108,7 @@ class BalanceTransactionServiceImpl internal constructor(private val clientOptio val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "balance_transactions") .build() .prepare(clientOptions, params) 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 b620e805..33b4b1de 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 @@ -3,12 +3,14 @@ package com.withorb.api.services.blocking.customers import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.CustomerCostListByExternalIdParams import com.withorb.api.models.CustomerCostListByExternalIdResponse import com.withorb.api.models.CustomerCostListParams import com.withorb.api.models.CustomerCostListResponse +import java.util.function.Consumer interface CostService { @@ -17,6 +19,13 @@ interface CostService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CostService + /** * This endpoint is used to fetch a day-by-day snapshot of a customer's costs in Orb, calculated * by applying pricing information to the underlying usage (see the @@ -314,6 +323,13 @@ interface CostService { /** A view of [CostService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CostService.WithRawResponse + /** * Returns a raw HTTP response for `get /customers/{customer_id}/costs`, but is otherwise * the same as [CostService.list]. 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 45fdbd67..822c9de8 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 @@ -19,6 +19,7 @@ import com.withorb.api.models.CustomerCostListByExternalIdParams import com.withorb.api.models.CustomerCostListByExternalIdResponse import com.withorb.api.models.CustomerCostListParams import com.withorb.api.models.CustomerCostListResponse +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class CostServiceImpl internal constructor(private val clientOptions: ClientOptions) : CostService { @@ -29,6 +30,9 @@ class CostServiceImpl internal constructor(private val clientOptions: ClientOpti override fun withRawResponse(): CostService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): CostService = + CostServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun list( params: CustomerCostListParams, requestOptions: RequestOptions, @@ -48,6 +52,13 @@ class CostServiceImpl internal constructor(private val clientOptions: ClientOpti private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): CostService.WithRawResponse = + CostServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -62,6 +73,7 @@ class CostServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "costs") .build() .prepare(clientOptions, params) @@ -92,6 +104,7 @@ class CostServiceImpl internal constructor(private val clientOptions: ClientOpti val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", 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 06e23be3..9bd94acd 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking.customers import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.CustomerCreditListByExternalIdPage @@ -11,6 +12,7 @@ import com.withorb.api.models.CustomerCreditListPage import com.withorb.api.models.CustomerCreditListParams import com.withorb.api.services.blocking.customers.credits.LedgerService import com.withorb.api.services.blocking.customers.credits.TopUpService +import java.util.function.Consumer interface CreditService { @@ -19,6 +21,13 @@ interface CreditService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CreditService + fun ledger(): LedgerService fun topUps(): TopUpService @@ -118,6 +127,13 @@ interface CreditService { /** A view of [CreditService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): CreditService.WithRawResponse + fun ledger(): LedgerService.WithRawResponse fun topUps(): TopUpService.WithRawResponse 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 30f623f9..a3040e3b 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 @@ -25,6 +25,7 @@ import com.withorb.api.services.blocking.customers.credits.LedgerService import com.withorb.api.services.blocking.customers.credits.LedgerServiceImpl import com.withorb.api.services.blocking.customers.credits.TopUpService import com.withorb.api.services.blocking.customers.credits.TopUpServiceImpl +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class CreditServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -40,6 +41,9 @@ class CreditServiceImpl internal constructor(private val clientOptions: ClientOp override fun withRawResponse(): CreditService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): CreditService = + CreditServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun ledger(): LedgerService = ledger override fun topUps(): TopUpService = topUps @@ -71,6 +75,13 @@ class CreditServiceImpl internal constructor(private val clientOptions: ClientOp TopUpServiceImpl.WithRawResponseImpl(clientOptions) } + override fun withOptions( + modifier: Consumer + ): CreditService.WithRawResponse = + CreditServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun ledger(): LedgerService.WithRawResponse = ledger override fun topUps(): TopUpService.WithRawResponse = topUps @@ -89,6 +100,7 @@ class CreditServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "credits") .build() .prepare(clientOptions, params) @@ -126,6 +138,7 @@ class CreditServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", 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 d23b56a7..943e063a 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking.customers.credits import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.CustomerCreditLedgerCreateEntryByExternalIdParams @@ -13,6 +14,7 @@ import com.withorb.api.models.CustomerCreditLedgerListByExternalIdPage import com.withorb.api.models.CustomerCreditLedgerListByExternalIdParams import com.withorb.api.models.CustomerCreditLedgerListPage import com.withorb.api.models.CustomerCreditLedgerListParams +import java.util.function.Consumer interface LedgerService { @@ -21,6 +23,13 @@ interface LedgerService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): LedgerService + /** * The credits ledger provides _auditing_ functionality over Orb's credits system with a list of * actions that have taken place to modify a customer's credit balance. This @@ -518,6 +527,13 @@ interface LedgerService { /** A view of [LedgerService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): LedgerService.WithRawResponse + /** * Returns a raw HTTP response for `get /customers/{customer_id}/credits/ledger`, but is * otherwise the same as [LedgerService.list]. 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 23ffb601..6ff494d2 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 @@ -26,6 +26,7 @@ import com.withorb.api.models.CustomerCreditLedgerListByExternalIdParams import com.withorb.api.models.CustomerCreditLedgerListPage import com.withorb.api.models.CustomerCreditLedgerListPageResponse import com.withorb.api.models.CustomerCreditLedgerListParams +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class LedgerServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -37,6 +38,9 @@ class LedgerServiceImpl internal constructor(private val clientOptions: ClientOp override fun withRawResponse(): LedgerService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): LedgerService = + LedgerServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun list( params: CustomerCreditLedgerListParams, requestOptions: RequestOptions, @@ -70,6 +74,13 @@ class LedgerServiceImpl internal constructor(private val clientOptions: ClientOp private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): LedgerService.WithRawResponse = + LedgerServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -84,6 +95,7 @@ class LedgerServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "credits", "ledger") .build() .prepare(clientOptions, params) @@ -121,6 +133,7 @@ class LedgerServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "credits", "ledger_entry") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -155,6 +168,7 @@ class LedgerServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", @@ -193,6 +207,7 @@ class LedgerServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", 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 27bee5fa..3d41ecb8 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking.customers.credits import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponse import com.withorb.api.core.http.HttpResponseFor @@ -16,6 +17,7 @@ import com.withorb.api.models.CustomerCreditTopUpListByExternalIdPage import com.withorb.api.models.CustomerCreditTopUpListByExternalIdParams import com.withorb.api.models.CustomerCreditTopUpListPage import com.withorb.api.models.CustomerCreditTopUpListParams +import java.util.function.Consumer interface TopUpService { @@ -24,6 +26,13 @@ interface TopUpService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): TopUpService + /** * This endpoint allows you to create a new top-up for a specified customer's balance. While * this top-up is active, the customer's balance will added in increments of the specified @@ -220,6 +229,13 @@ interface TopUpService { /** A view of [TopUpService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): TopUpService.WithRawResponse + /** * Returns a raw HTTP response for `post /customers/{customer_id}/credits/top_ups`, but is * otherwise the same as [TopUpService.create]. 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 39568133..2ab5a1d6 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 @@ -30,6 +30,7 @@ import com.withorb.api.models.CustomerCreditTopUpListByExternalIdParams import com.withorb.api.models.CustomerCreditTopUpListPage import com.withorb.api.models.CustomerCreditTopUpListPageResponse import com.withorb.api.models.CustomerCreditTopUpListParams +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class TopUpServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -41,6 +42,9 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt override fun withRawResponse(): TopUpService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): TopUpService = + TopUpServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: CustomerCreditTopUpCreateParams, requestOptions: RequestOptions, @@ -87,6 +91,13 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): TopUpService.WithRawResponse = + TopUpServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -101,6 +112,7 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "credits", "top_ups") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -132,6 +144,7 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("customers", params._pathParam(0), "credits", "top_ups") .build() .prepare(clientOptions, params) @@ -167,6 +180,7 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", params._pathParam(0), @@ -197,6 +211,7 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", @@ -233,6 +248,7 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", @@ -264,6 +280,7 @@ class TopUpServiceImpl internal constructor(private val clientOptions: ClientOpt val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "customers", "external_customer_id", 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 ccc38f0f..6f08adc0 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 @@ -3,10 +3,12 @@ package com.withorb.api.services.blocking.dimensionalPriceGroups import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.DimensionalPriceGroup import com.withorb.api.models.DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams +import java.util.function.Consumer interface ExternalDimensionalPriceGroupIdService { @@ -15,6 +17,15 @@ interface ExternalDimensionalPriceGroupIdService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ExternalDimensionalPriceGroupIdService + /** Fetch dimensional price group by external ID */ fun retrieve(externalDimensionalPriceGroupId: String): DimensionalPriceGroup = retrieve( @@ -73,6 +84,15 @@ interface ExternalDimensionalPriceGroupIdService { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ExternalDimensionalPriceGroupIdService.WithRawResponse + /** * Returns a raw HTTP response for `get * /dimensional_price_groups/external_dimensional_price_group_id/{external_dimensional_price_group_id}`, 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 ce3cd2e7..adf74156 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 @@ -17,6 +17,7 @@ import com.withorb.api.core.http.parseable import com.withorb.api.core.prepare import com.withorb.api.models.DimensionalPriceGroup import com.withorb.api.models.DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class ExternalDimensionalPriceGroupIdServiceImpl @@ -30,6 +31,13 @@ internal constructor(private val clientOptions: ClientOptions) : override fun withRawResponse(): ExternalDimensionalPriceGroupIdService.WithRawResponse = withRawResponse + override fun withOptions( + modifier: Consumer + ): ExternalDimensionalPriceGroupIdService = + ExternalDimensionalPriceGroupIdServiceImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + override fun retrieve( params: DimensionalPriceGroupExternalDimensionalPriceGroupIdRetrieveParams, requestOptions: RequestOptions, @@ -43,6 +51,13 @@ internal constructor(private val clientOptions: ClientOptions) : private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): ExternalDimensionalPriceGroupIdService.WithRawResponse = + ExternalDimensionalPriceGroupIdServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -60,6 +75,7 @@ internal constructor(private val clientOptions: ClientOptions) : val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments( "dimensional_price_groups", "external_dimensional_price_group_id", 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 d5835949..1bf135e8 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 @@ -3,6 +3,7 @@ package com.withorb.api.services.blocking.events import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.EventBackfillCloseParams @@ -15,6 +16,7 @@ import com.withorb.api.models.EventBackfillListPage import com.withorb.api.models.EventBackfillListParams import com.withorb.api.models.EventBackfillRevertParams import com.withorb.api.models.EventBackfillRevertResponse +import java.util.function.Consumer interface BackfillService { @@ -23,6 +25,13 @@ interface BackfillService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): BackfillService + /** * Creating the backfill enables adding or replacing past events, even those that are older than * the ingestion grace period. Performing a backfill in Orb involves 3 steps: @@ -197,6 +206,13 @@ interface BackfillService { /** A view of [BackfillService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): BackfillService.WithRawResponse + /** * Returns a raw HTTP response for `post /events/backfills`, but is otherwise the same as * [BackfillService.create]. 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 6fbf3336..7e5ab2da 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 @@ -27,6 +27,7 @@ import com.withorb.api.models.EventBackfillListPageResponse import com.withorb.api.models.EventBackfillListParams import com.withorb.api.models.EventBackfillRevertParams import com.withorb.api.models.EventBackfillRevertResponse +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class BackfillServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -38,6 +39,9 @@ class BackfillServiceImpl internal constructor(private val clientOptions: Client override fun withRawResponse(): BackfillService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): BackfillService = + BackfillServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( params: EventBackfillCreateParams, requestOptions: RequestOptions, @@ -78,6 +82,13 @@ class BackfillServiceImpl internal constructor(private val clientOptions: Client private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): BackfillService.WithRawResponse = + BackfillServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) @@ -89,6 +100,7 @@ class BackfillServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "backfills") .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -117,6 +129,7 @@ class BackfillServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "backfills") .build() .prepare(clientOptions, params) @@ -154,6 +167,7 @@ class BackfillServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "backfills", params._pathParam(0), "close") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() @@ -185,6 +199,7 @@ class BackfillServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "backfills", params._pathParam(0)) .build() .prepare(clientOptions, params) @@ -215,6 +230,7 @@ class BackfillServiceImpl internal constructor(private val clientOptions: Client val request = HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "backfills", params._pathParam(0), "revert") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() 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 8241b016..b895c4bb 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 @@ -3,10 +3,12 @@ package com.withorb.api.services.blocking.events import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.EventVolumeListParams import com.withorb.api.models.EventVolumes +import java.util.function.Consumer interface VolumeService { @@ -15,6 +17,13 @@ interface VolumeService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): VolumeService + /** * This endpoint returns the event volume for an account in a * [paginated list format](/api-reference/pagination). @@ -39,6 +48,13 @@ interface VolumeService { /** A view of [VolumeService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): VolumeService.WithRawResponse + /** * Returns a raw HTTP response for `get /events/volume`, but is otherwise the same as * [VolumeService.list]. 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 e26afcd9..7795f004 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 @@ -16,6 +16,7 @@ import com.withorb.api.core.http.parseable import com.withorb.api.core.prepare import com.withorb.api.models.EventVolumeListParams import com.withorb.api.models.EventVolumes +import java.util.function.Consumer class VolumeServiceImpl internal constructor(private val clientOptions: ClientOptions) : VolumeService { @@ -26,6 +27,9 @@ class VolumeServiceImpl internal constructor(private val clientOptions: ClientOp override fun withRawResponse(): VolumeService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): VolumeService = + VolumeServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun list(params: EventVolumeListParams, requestOptions: RequestOptions): EventVolumes = // get /events/volume withRawResponse().list(params, requestOptions).parse() @@ -35,6 +39,13 @@ class VolumeServiceImpl internal constructor(private val clientOptions: ClientOp private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): VolumeService.WithRawResponse = + VolumeServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val listHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -45,6 +56,7 @@ class VolumeServiceImpl internal constructor(private val clientOptions: ClientOp val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("events", "volume") .build() .prepare(clientOptions, params) 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 d65d7faf..e54cc288 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 @@ -3,11 +3,13 @@ package com.withorb.api.services.blocking.plans import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Plan import com.withorb.api.models.PlanExternalPlanIdFetchParams import com.withorb.api.models.PlanExternalPlanIdUpdateParams +import java.util.function.Consumer interface ExternalPlanIdService { @@ -16,6 +18,13 @@ interface ExternalPlanIdService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ExternalPlanIdService + /** * This endpoint can be used to update the `external_plan_id`, and `metadata` of an existing * plan. @@ -103,6 +112,15 @@ interface ExternalPlanIdService { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ExternalPlanIdService.WithRawResponse + /** * Returns a raw HTTP response for `put /plans/external_plan_id/{external_plan_id}`, but is * otherwise the same as [ExternalPlanIdService.update]. 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 6fccf86e..5f49584c 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 @@ -19,6 +19,7 @@ import com.withorb.api.core.prepare import com.withorb.api.models.Plan import com.withorb.api.models.PlanExternalPlanIdFetchParams import com.withorb.api.models.PlanExternalPlanIdUpdateParams +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -30,6 +31,9 @@ class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: override fun withRawResponse(): ExternalPlanIdService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): ExternalPlanIdService = + ExternalPlanIdServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun update( params: PlanExternalPlanIdUpdateParams, requestOptions: RequestOptions, @@ -49,6 +53,13 @@ class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): ExternalPlanIdService.WithRawResponse = + ExternalPlanIdServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -62,6 +73,7 @@ class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", "external_plan_id", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -92,6 +104,7 @@ class ExternalPlanIdServiceImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("plans", "external_plan_id", params._pathParam(0)) .build() .prepare(clientOptions, params) 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 4ea638ff..2615e99d 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 @@ -3,11 +3,13 @@ package com.withorb.api.services.blocking.prices import com.google.errorprone.annotations.MustBeClosed +import com.withorb.api.core.ClientOptions import com.withorb.api.core.RequestOptions import com.withorb.api.core.http.HttpResponseFor import com.withorb.api.models.Price import com.withorb.api.models.PriceExternalPriceIdFetchParams import com.withorb.api.models.PriceExternalPriceIdUpdateParams +import java.util.function.Consumer interface ExternalPriceIdService { @@ -16,6 +18,13 @@ interface ExternalPriceIdService { */ fun withRawResponse(): WithRawResponse + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): ExternalPriceIdService + /** * This endpoint allows you to update the `metadata` property on a price. If you pass null for * the metadata value, it will clear any existing metadata for that price. @@ -90,6 +99,15 @@ interface ExternalPriceIdService { */ interface WithRawResponse { + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): ExternalPriceIdService.WithRawResponse + /** * Returns a raw HTTP response for `put /prices/external_price_id/{external_price_id}`, but * is otherwise the same as [ExternalPriceIdService.update]. 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 b0c9db98..ddcaf01b 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 @@ -19,6 +19,7 @@ import com.withorb.api.core.prepare import com.withorb.api.models.Price import com.withorb.api.models.PriceExternalPriceIdFetchParams import com.withorb.api.models.PriceExternalPriceIdUpdateParams +import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull class ExternalPriceIdServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -30,6 +31,9 @@ class ExternalPriceIdServiceImpl internal constructor(private val clientOptions: override fun withRawResponse(): ExternalPriceIdService.WithRawResponse = withRawResponse + override fun withOptions(modifier: Consumer): ExternalPriceIdService = + ExternalPriceIdServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun update( params: PriceExternalPriceIdUpdateParams, requestOptions: RequestOptions, @@ -49,6 +53,13 @@ class ExternalPriceIdServiceImpl internal constructor(private val clientOptions: private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + override fun withOptions( + modifier: Consumer + ): ExternalPriceIdService.WithRawResponse = + ExternalPriceIdServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) @@ -62,6 +73,7 @@ class ExternalPriceIdServiceImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", "external_price_id", params._pathParam(0)) .body(json(clientOptions.jsonMapper, params._body())) .build() @@ -92,6 +104,7 @@ class ExternalPriceIdServiceImpl internal constructor(private val clientOptions: val request = HttpRequest.builder() .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) .addPathSegments("prices", "external_price_id", params._pathParam(0)) .build() .prepare(clientOptions, params) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/core/ClientOptionsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/core/ClientOptionsTest.kt new file mode 100644 index 00000000..24e6362f --- /dev/null +++ b/orb-java-core/src/test/kotlin/com/withorb/api/core/ClientOptionsTest.kt @@ -0,0 +1,34 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.withorb.api.core + +import com.withorb.api.core.http.HttpClient +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith +import org.mockito.junit.jupiter.MockitoExtension +import org.mockito.kotlin.mock +import org.mockito.kotlin.never +import org.mockito.kotlin.verify + +@ExtendWith(MockitoExtension::class) +internal class ClientOptionsTest { + + private val httpClient = mock() + + @Test + fun toBuilder_whenOriginalClientOptionsGarbageCollected_doesNotCloseOriginalClient() { + var clientOptions = + ClientOptions.builder().httpClient(httpClient).apiKey("My API Key").build() + verify(httpClient, never()).close() + + // Overwrite the `clientOptions` variable so that the original `ClientOptions` is GC'd. + clientOptions = clientOptions.toBuilder().build() + System.gc() + Thread.sleep(100) + + verify(httpClient, never()).close() + // This exists so that `clientOptions` is still reachable. + assertThat(clientOptions).isEqualTo(clientOptions) + } +} 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 1a348919..d29d49e4 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 @@ -20,11 +20,13 @@ import org.junit.jupiter.params.provider.ValueSource internal class RetryingHttpClientTest { private var openResponseCount = 0 + private lateinit var baseUrl: String private lateinit var httpClient: HttpClient @BeforeEach fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { - val okHttpClient = OkHttpClient.builder().baseUrl(wmRuntimeInfo.httpBaseUrl).build() + baseUrl = wmRuntimeInfo.httpBaseUrl + val okHttpClient = OkHttpClient.builder().build() httpClient = object : HttpClient { @@ -75,7 +77,11 @@ internal class RetryingHttpClientTest { val response = retryingClient.execute( - HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(baseUrl) + .addPathSegment("something") + .build(), async, ) @@ -97,7 +103,11 @@ internal class RetryingHttpClientTest { val response = retryingClient.execute( - HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(baseUrl) + .addPathSegment("something") + .build(), async, ) @@ -139,7 +149,11 @@ internal class RetryingHttpClientTest { val response = retryingClient.execute( - HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(baseUrl) + .addPathSegment("something") + .build(), async, ) @@ -187,6 +201,7 @@ internal class RetryingHttpClientTest { retryingClient.execute( HttpRequest.builder() .method(HttpMethod.POST) + .baseUrl(baseUrl) .addPathSegment("something") .putHeader("x-stainless-retry-count", "42") .build(), @@ -223,7 +238,11 @@ internal class RetryingHttpClientTest { val response = retryingClient.execute( - HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(baseUrl) + .addPathSegment("something") + .build(), async, ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AdjustmentIntervalTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AdjustmentIntervalTest.kt index 8e86366e..3ccd89f3 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AdjustmentIntervalTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AdjustmentIntervalTest.kt @@ -32,6 +32,7 @@ internal class AdjustmentIntervalTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -60,6 +61,7 @@ internal class AdjustmentIntervalTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -94,6 +96,7 @@ internal class AdjustmentIntervalTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AggregatedCostTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AggregatedCostTest.kt index dd1b3bc1..f62a16ed 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AggregatedCostTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AggregatedCostTest.kt @@ -109,6 +109,7 @@ internal class AggregatedCostTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -223,6 +224,7 @@ internal class AggregatedCostTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -345,6 +347,7 @@ internal class AggregatedCostTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/BetaCreatePlanVersionParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/BetaCreatePlanVersionParamsTest.kt index 43f6ee67..202bce7d 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/BetaCreatePlanVersionParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/BetaCreatePlanVersionParamsTest.kt @@ -102,6 +102,7 @@ internal class BetaCreatePlanVersionParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -208,6 +209,7 @@ internal class BetaCreatePlanVersionParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -321,6 +323,7 @@ internal class BetaCreatePlanVersionParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -429,6 +432,7 @@ internal class BetaCreatePlanVersionParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -529,6 +533,7 @@ internal class BetaCreatePlanVersionParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -639,6 +644,7 @@ internal class BetaCreatePlanVersionParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/BetaExternalPlanIdCreatePlanVersionParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/BetaExternalPlanIdCreatePlanVersionParamsTest.kt index 4d34c56a..bda42ce3 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/BetaExternalPlanIdCreatePlanVersionParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/BetaExternalPlanIdCreatePlanVersionParamsTest.kt @@ -102,6 +102,7 @@ internal class BetaExternalPlanIdCreatePlanVersionParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -208,6 +209,7 @@ internal class BetaExternalPlanIdCreatePlanVersionParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -325,6 +327,7 @@ internal class BetaExternalPlanIdCreatePlanVersionParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -433,6 +436,7 @@ internal class BetaExternalPlanIdCreatePlanVersionParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -533,6 +537,7 @@ internal class BetaExternalPlanIdCreatePlanVersionParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -643,6 +648,7 @@ internal class BetaExternalPlanIdCreatePlanVersionParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/ChangedSubscriptionResourcesTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/ChangedSubscriptionResourcesTest.kt index 472f4ae0..402b82b7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/ChangedSubscriptionResourcesTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/ChangedSubscriptionResourcesTest.kt @@ -213,6 +213,7 @@ internal class ChangedSubscriptionResourcesTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -378,6 +379,7 @@ internal class ChangedSubscriptionResourcesTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -688,6 +690,7 @@ internal class ChangedSubscriptionResourcesTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -853,6 +856,7 @@ internal class ChangedSubscriptionResourcesTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -1163,6 +1167,7 @@ internal class ChangedSubscriptionResourcesTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1321,6 +1326,7 @@ internal class ChangedSubscriptionResourcesTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -1627,6 +1633,7 @@ internal class ChangedSubscriptionResourcesTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1785,6 +1792,7 @@ internal class ChangedSubscriptionResourcesTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -2100,6 +2108,7 @@ internal class ChangedSubscriptionResourcesTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2265,6 +2274,7 @@ internal class ChangedSubscriptionResourcesTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -2575,6 +2585,7 @@ internal class ChangedSubscriptionResourcesTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2740,6 +2751,7 @@ internal class ChangedSubscriptionResourcesTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponseTest.kt index 8192d77f..21dd041d 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 @@ -130,6 +130,7 @@ internal class CustomerCostListByExternalIdResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -266,6 +267,7 @@ internal class CustomerCostListByExternalIdResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -411,6 +413,7 @@ internal class CustomerCostListByExternalIdResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").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 a566846a..d6bcaf78 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 @@ -130,6 +130,7 @@ internal class CustomerCostListResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -266,6 +267,7 @@ internal class CustomerCostListResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -411,6 +413,7 @@ internal class CustomerCostListResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponseTest.kt index f42e285b..3e39c0bf 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdResponseTest.kt @@ -163,6 +163,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -328,6 +329,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -607,6 +609,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -791,6 +794,7 @@ internal class CustomerCreditLedgerCreateEntryByExternalIdResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponseTest.kt index ff13ae80..ae60ab6b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryResponseTest.kt @@ -163,6 +163,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -328,6 +329,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -606,6 +608,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -790,6 +793,7 @@ internal class CustomerCreditLedgerCreateEntryResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponseTest.kt index 2c3d3734..79e0ce7e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdPageResponseTest.kt @@ -170,6 +170,7 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -363,6 +364,7 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -647,6 +649,7 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -840,6 +843,7 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -1127,6 +1131,7 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1320,6 +1325,7 @@ internal class CustomerCreditLedgerListByExternalIdPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponseTest.kt index f43ae861..9db46fd7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdResponseTest.kt @@ -163,6 +163,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -328,6 +329,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -606,6 +608,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -790,6 +793,7 @@ internal class CustomerCreditLedgerListByExternalIdResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponseTest.kt index b026a2b6..3c66b293 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListPageResponseTest.kt @@ -170,6 +170,7 @@ internal class CustomerCreditLedgerListPageResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -363,6 +364,7 @@ internal class CustomerCreditLedgerListPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -647,6 +649,7 @@ internal class CustomerCreditLedgerListPageResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -840,6 +843,7 @@ internal class CustomerCreditLedgerListPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -1127,6 +1131,7 @@ internal class CustomerCreditLedgerListPageResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1320,6 +1325,7 @@ internal class CustomerCreditLedgerListPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponseTest.kt index f813cdc1..3c2c8944 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CustomerCreditLedgerListResponseTest.kt @@ -163,6 +163,7 @@ internal class CustomerCreditLedgerListResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -328,6 +329,7 @@ internal class CustomerCreditLedgerListResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -606,6 +608,7 @@ internal class CustomerCreditLedgerListResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -790,6 +793,7 @@ internal class CustomerCreditLedgerListResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/IncrementLedgerEntryTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/IncrementLedgerEntryTest.kt index 04bbb552..c1a3b297 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/IncrementLedgerEntryTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/IncrementLedgerEntryTest.kt @@ -160,6 +160,7 @@ internal class IncrementLedgerEntryTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -325,6 +326,7 @@ internal class IncrementLedgerEntryTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -586,6 +588,7 @@ internal class IncrementLedgerEntryTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -744,6 +747,7 @@ internal class IncrementLedgerEntryTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -1005,6 +1009,7 @@ internal class IncrementLedgerEntryTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1170,6 +1175,7 @@ internal class IncrementLedgerEntryTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponseTest.kt index d85dae35..58e832ad 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponseTest.kt @@ -126,6 +126,7 @@ internal class InvoiceFetchUpcomingResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -272,6 +273,7 @@ internal class InvoiceFetchUpcomingResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -510,6 +512,7 @@ internal class InvoiceFetchUpcomingResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -654,6 +657,7 @@ internal class InvoiceFetchUpcomingResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -892,6 +896,7 @@ internal class InvoiceFetchUpcomingResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1038,6 +1043,7 @@ internal class InvoiceFetchUpcomingResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt index 7cdb6852..fe32e14d 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponseTest.kt @@ -35,6 +35,7 @@ internal class InvoiceLineItemCreateResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -179,6 +180,7 @@ internal class InvoiceLineItemCreateResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -234,6 +236,7 @@ internal class InvoiceLineItemCreateResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -387,6 +390,7 @@ internal class InvoiceLineItemCreateResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -452,6 +456,7 @@ internal class InvoiceLineItemCreateResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -596,6 +601,7 @@ internal class InvoiceLineItemCreateResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListPageResponseTest.kt index 5b8aea8f..56d7eff0 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceListPageResponseTest.kt @@ -131,6 +131,7 @@ internal class InvoiceListPageResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -296,6 +297,7 @@ internal class InvoiceListPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -526,6 +528,7 @@ internal class InvoiceListPageResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -684,6 +687,7 @@ internal class InvoiceListPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -919,6 +923,7 @@ internal class InvoiceListPageResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1084,6 +1089,7 @@ internal class InvoiceListPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceTest.kt index a67dfc94..c6855dbf 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/InvoiceTest.kt @@ -122,6 +122,7 @@ internal class InvoiceTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -268,6 +269,7 @@ internal class InvoiceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -497,6 +499,7 @@ internal class InvoiceTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -641,6 +644,7 @@ internal class InvoiceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -868,6 +872,7 @@ internal class InvoiceTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1014,6 +1019,7 @@ internal class InvoiceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryAmountDiscountAdjustmentTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryAmountDiscountAdjustmentTest.kt index ff6cd72b..c6e6b99d 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryAmountDiscountAdjustmentTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryAmountDiscountAdjustmentTest.kt @@ -27,6 +27,7 @@ internal class MonetaryAmountDiscountAdjustmentTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() assertThat(monetaryAmountDiscountAdjustment.id()).isEqualTo("id") @@ -45,6 +46,8 @@ internal class MonetaryAmountDiscountAdjustmentTest { ) assertThat(monetaryAmountDiscountAdjustment.isInvoiceLevel()).isEqualTo(true) assertThat(monetaryAmountDiscountAdjustment.reason()).contains("reason") + assertThat(monetaryAmountDiscountAdjustment.replacesAdjustmentId()) + .contains("replaces_adjustment_id") } @Test @@ -66,6 +69,7 @@ internal class MonetaryAmountDiscountAdjustmentTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() val roundtrippedMonetaryAmountDiscountAdjustment = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryMaximumAdjustmentTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryMaximumAdjustmentTest.kt index 41d80d0b..19a9c30e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryMaximumAdjustmentTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryMaximumAdjustmentTest.kt @@ -27,6 +27,7 @@ internal class MonetaryMaximumAdjustmentTest { .isInvoiceLevel(true) .maximumAmount("maximum_amount") .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() assertThat(monetaryMaximumAdjustment.id()).isEqualTo("id") @@ -45,6 +46,8 @@ internal class MonetaryMaximumAdjustmentTest { assertThat(monetaryMaximumAdjustment.isInvoiceLevel()).isEqualTo(true) assertThat(monetaryMaximumAdjustment.maximumAmount()).isEqualTo("maximum_amount") assertThat(monetaryMaximumAdjustment.reason()).contains("reason") + assertThat(monetaryMaximumAdjustment.replacesAdjustmentId()) + .contains("replaces_adjustment_id") } @Test @@ -66,6 +69,7 @@ internal class MonetaryMaximumAdjustmentTest { .isInvoiceLevel(true) .maximumAmount("maximum_amount") .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() val roundtrippedMonetaryMaximumAdjustment = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryMinimumAdjustmentTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryMinimumAdjustmentTest.kt index 2f49e922..df8d889b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryMinimumAdjustmentTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryMinimumAdjustmentTest.kt @@ -28,6 +28,7 @@ internal class MonetaryMinimumAdjustmentTest { .itemId("item_id") .minimumAmount("minimum_amount") .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() assertThat(monetaryMinimumAdjustment.id()).isEqualTo("id") @@ -47,6 +48,8 @@ internal class MonetaryMinimumAdjustmentTest { assertThat(monetaryMinimumAdjustment.itemId()).isEqualTo("item_id") assertThat(monetaryMinimumAdjustment.minimumAmount()).isEqualTo("minimum_amount") assertThat(monetaryMinimumAdjustment.reason()).contains("reason") + assertThat(monetaryMinimumAdjustment.replacesAdjustmentId()) + .contains("replaces_adjustment_id") } @Test @@ -69,6 +72,7 @@ internal class MonetaryMinimumAdjustmentTest { .itemId("item_id") .minimumAmount("minimum_amount") .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() val roundtrippedMonetaryMinimumAdjustment = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryPercentageDiscountAdjustmentTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryPercentageDiscountAdjustmentTest.kt index 1f2a062c..11391743 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryPercentageDiscountAdjustmentTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryPercentageDiscountAdjustmentTest.kt @@ -29,6 +29,7 @@ internal class MonetaryPercentageDiscountAdjustmentTest { .isInvoiceLevel(true) .percentageDiscount(0.0) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() assertThat(monetaryPercentageDiscountAdjustment.id()).isEqualTo("id") @@ -48,6 +49,8 @@ internal class MonetaryPercentageDiscountAdjustmentTest { assertThat(monetaryPercentageDiscountAdjustment.isInvoiceLevel()).isEqualTo(true) assertThat(monetaryPercentageDiscountAdjustment.percentageDiscount()).isEqualTo(0.0) assertThat(monetaryPercentageDiscountAdjustment.reason()).contains("reason") + assertThat(monetaryPercentageDiscountAdjustment.replacesAdjustmentId()) + .contains("replaces_adjustment_id") } @Test @@ -71,6 +74,7 @@ internal class MonetaryPercentageDiscountAdjustmentTest { .isInvoiceLevel(true) .percentageDiscount(0.0) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() val roundtrippedMonetaryPercentageDiscountAdjustment = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryUsageDiscountAdjustmentTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryUsageDiscountAdjustmentTest.kt index 00e24836..bb3f0fdc 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryUsageDiscountAdjustmentTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/MonetaryUsageDiscountAdjustmentTest.kt @@ -26,6 +26,7 @@ internal class MonetaryUsageDiscountAdjustmentTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() @@ -44,6 +45,8 @@ internal class MonetaryUsageDiscountAdjustmentTest { ) assertThat(monetaryUsageDiscountAdjustment.isInvoiceLevel()).isEqualTo(true) assertThat(monetaryUsageDiscountAdjustment.reason()).contains("reason") + assertThat(monetaryUsageDiscountAdjustment.replacesAdjustmentId()) + .contains("replaces_adjustment_id") assertThat(monetaryUsageDiscountAdjustment.usageDiscount()).isEqualTo(0.0) } @@ -65,6 +68,7 @@ internal class MonetaryUsageDiscountAdjustmentTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/MutatedSubscriptionTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/MutatedSubscriptionTest.kt index a868aa55..2980d769 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/MutatedSubscriptionTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/MutatedSubscriptionTest.kt @@ -37,6 +37,7 @@ internal class MutatedSubscriptionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -224,6 +225,7 @@ internal class MutatedSubscriptionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -438,6 +440,7 @@ internal class MutatedSubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -575,6 +578,7 @@ internal class MutatedSubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -814,6 +818,7 @@ internal class MutatedSubscriptionTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1007,6 +1012,7 @@ internal class MutatedSubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -1337,6 +1343,7 @@ internal class MutatedSubscriptionTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1530,6 +1537,7 @@ internal class MutatedSubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -1677,6 +1685,7 @@ internal class MutatedSubscriptionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1876,6 +1885,7 @@ internal class MutatedSubscriptionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2088,6 +2098,7 @@ internal class MutatedSubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -2220,6 +2231,7 @@ internal class MutatedSubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -2453,6 +2465,7 @@ internal class MutatedSubscriptionTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2637,6 +2650,7 @@ internal class MutatedSubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -2953,6 +2967,7 @@ internal class MutatedSubscriptionTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -3137,6 +3152,7 @@ internal class MutatedSubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -3284,6 +3300,7 @@ internal class MutatedSubscriptionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -3471,6 +3488,7 @@ internal class MutatedSubscriptionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -3685,6 +3703,7 @@ internal class MutatedSubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -3822,6 +3841,7 @@ internal class MutatedSubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -4061,6 +4081,7 @@ internal class MutatedSubscriptionTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -4254,6 +4275,7 @@ internal class MutatedSubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -4584,6 +4606,7 @@ internal class MutatedSubscriptionTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -4777,6 +4800,7 @@ internal class MutatedSubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBpsPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBpsPriceTest.kt index c922874c..011577ed 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBpsPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBpsPriceTest.kt @@ -53,6 +53,7 @@ internal class NewPlanBpsPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanBpsPrice.bpsConfig()) @@ -107,6 +108,7 @@ internal class NewPlanBpsPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanBpsPrice.referenceId()).contains("reference_id") } @Test @@ -153,6 +155,7 @@ internal class NewPlanBpsPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanBpsPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBulkBpsPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBulkBpsPriceTest.kt index 9f8c3a69..8b0c1e0c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBulkBpsPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBulkBpsPriceTest.kt @@ -63,6 +63,7 @@ internal class NewPlanBulkBpsPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanBulkBpsPrice.bulkBpsConfig()) @@ -128,6 +129,7 @@ internal class NewPlanBulkBpsPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanBulkBpsPrice.referenceId()).contains("reference_id") } @Test @@ -184,6 +186,7 @@ internal class NewPlanBulkBpsPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanBulkBpsPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBulkPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBulkPriceTest.kt index 8d22a83f..c30ab03f 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBulkPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBulkPriceTest.kt @@ -59,6 +59,7 @@ internal class NewPlanBulkPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanBulkPrice.bulkConfig()) @@ -117,6 +118,7 @@ internal class NewPlanBulkPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanBulkPrice.referenceId()).contains("reference_id") } @Test @@ -169,6 +171,7 @@ internal class NewPlanBulkPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanBulkPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBulkWithProrationPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBulkWithProrationPriceTest.kt index d9082bb6..26145069 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBulkWithProrationPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanBulkWithProrationPriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanBulkWithProrationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanBulkWithProrationPrice.bulkWithProrationConfig()) @@ -117,6 +118,7 @@ internal class NewPlanBulkWithProrationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanBulkWithProrationPrice.referenceId()).contains("reference_id") } @Test @@ -167,6 +169,7 @@ internal class NewPlanBulkWithProrationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanBulkWithProrationPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanCumulativeGroupedBulkPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanCumulativeGroupedBulkPriceTest.kt index bbf51292..5cbd254f 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanCumulativeGroupedBulkPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanCumulativeGroupedBulkPriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanCumulativeGroupedBulkPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanCumulativeGroupedBulkPrice.cadence()) @@ -119,6 +120,7 @@ internal class NewPlanCumulativeGroupedBulkPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanCumulativeGroupedBulkPrice.referenceId()).contains("reference_id") } @Test @@ -169,6 +171,7 @@ internal class NewPlanCumulativeGroupedBulkPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanCumulativeGroupedBulkPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedAllocationPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedAllocationPriceTest.kt index 1c69ae6a..eca31922 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedAllocationPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedAllocationPriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanGroupedAllocationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanGroupedAllocationPrice.cadence()) @@ -117,6 +118,7 @@ internal class NewPlanGroupedAllocationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanGroupedAllocationPrice.referenceId()).contains("reference_id") } @Test @@ -167,6 +169,7 @@ internal class NewPlanGroupedAllocationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanGroupedAllocationPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedTieredPackagePriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedTieredPackagePriceTest.kt index 4b8bffbd..7f9a77d9 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedTieredPackagePriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedTieredPackagePriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanGroupedTieredPackagePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanGroupedTieredPackagePrice.cadence()) @@ -118,6 +119,7 @@ internal class NewPlanGroupedTieredPackagePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanGroupedTieredPackagePrice.referenceId()).contains("reference_id") } @Test @@ -168,6 +170,7 @@ internal class NewPlanGroupedTieredPackagePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanGroupedTieredPackagePrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedTieredPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedTieredPriceTest.kt index 91c55062..12aa9b79 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedTieredPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedTieredPriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanGroupedTieredPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanGroupedTieredPrice.cadence()) @@ -117,6 +118,7 @@ internal class NewPlanGroupedTieredPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanGroupedTieredPrice.referenceId()).contains("reference_id") } @Test @@ -167,6 +169,7 @@ internal class NewPlanGroupedTieredPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanGroupedTieredPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedWithMeteredMinimumPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedWithMeteredMinimumPriceTest.kt index fcf037ee..6360b97e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedWithMeteredMinimumPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedWithMeteredMinimumPriceTest.kt @@ -59,6 +59,7 @@ internal class NewPlanGroupedWithMeteredMinimumPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanGroupedWithMeteredMinimumPrice.cadence()) @@ -121,6 +122,7 @@ internal class NewPlanGroupedWithMeteredMinimumPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanGroupedWithMeteredMinimumPrice.referenceId()).contains("reference_id") } @Test @@ -173,6 +175,7 @@ internal class NewPlanGroupedWithMeteredMinimumPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanGroupedWithMeteredMinimumPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedWithProratedMinimumPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedWithProratedMinimumPriceTest.kt index f9928fe2..63cd1b2b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedWithProratedMinimumPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanGroupedWithProratedMinimumPriceTest.kt @@ -60,6 +60,7 @@ internal class NewPlanGroupedWithProratedMinimumPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanGroupedWithProratedMinimumPrice.cadence()) @@ -124,6 +125,7 @@ internal class NewPlanGroupedWithProratedMinimumPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanGroupedWithProratedMinimumPrice.referenceId()).contains("reference_id") } @Test @@ -177,6 +179,7 @@ internal class NewPlanGroupedWithProratedMinimumPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanGroupedWithProratedMinimumPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMatrixPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMatrixPriceTest.kt index c6db7fa5..2689a9de 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMatrixPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMatrixPriceTest.kt @@ -64,6 +64,7 @@ internal class NewPlanMatrixPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanMatrixPrice.cadence()).isEqualTo(NewPlanMatrixPrice.Cadence.ANNUAL) @@ -129,6 +130,7 @@ internal class NewPlanMatrixPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanMatrixPrice.referenceId()).contains("reference_id") } @Test @@ -186,6 +188,7 @@ internal class NewPlanMatrixPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanMatrixPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMatrixWithAllocationPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMatrixWithAllocationPriceTest.kt index a87b7db7..2a7e30fe 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMatrixWithAllocationPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMatrixWithAllocationPriceTest.kt @@ -65,6 +65,7 @@ internal class NewPlanMatrixWithAllocationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanMatrixWithAllocationPrice.cadence()) @@ -134,6 +135,7 @@ internal class NewPlanMatrixWithAllocationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanMatrixWithAllocationPrice.referenceId()).contains("reference_id") } @Test @@ -192,6 +194,7 @@ internal class NewPlanMatrixWithAllocationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanMatrixWithAllocationPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMatrixWithDisplayNamePriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMatrixWithDisplayNamePriceTest.kt index 2f9be8bf..23a3f0e4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMatrixWithDisplayNamePriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMatrixWithDisplayNamePriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanMatrixWithDisplayNamePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanMatrixWithDisplayNamePrice.cadence()) @@ -119,6 +120,7 @@ internal class NewPlanMatrixWithDisplayNamePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanMatrixWithDisplayNamePrice.referenceId()).contains("reference_id") } @Test @@ -169,6 +171,7 @@ internal class NewPlanMatrixWithDisplayNamePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanMatrixWithDisplayNamePrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMaxGroupTieredPackagePriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMaxGroupTieredPackagePriceTest.kt index 80879fd4..090e779c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMaxGroupTieredPackagePriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanMaxGroupTieredPackagePriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanMaxGroupTieredPackagePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanMaxGroupTieredPackagePrice.cadence()) @@ -119,6 +120,7 @@ internal class NewPlanMaxGroupTieredPackagePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanMaxGroupTieredPackagePrice.referenceId()).contains("reference_id") } @Test @@ -169,6 +171,7 @@ internal class NewPlanMaxGroupTieredPackagePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanMaxGroupTieredPackagePrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanPackagePriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanPackagePriceTest.kt index f7deb20c..2fa6bad6 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanPackagePriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanPackagePriceTest.kt @@ -55,6 +55,7 @@ internal class NewPlanPackagePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanPackagePrice.cadence()).isEqualTo(NewPlanPackagePrice.Cadence.ANNUAL) @@ -111,6 +112,7 @@ internal class NewPlanPackagePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanPackagePrice.referenceId()).contains("reference_id") } @Test @@ -159,6 +161,7 @@ internal class NewPlanPackagePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanPackagePrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanPackageWithAllocationPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanPackageWithAllocationPriceTest.kt index b32e4665..ca6d749e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanPackageWithAllocationPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanPackageWithAllocationPriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanPackageWithAllocationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanPackageWithAllocationPrice.cadence()) @@ -119,6 +120,7 @@ internal class NewPlanPackageWithAllocationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanPackageWithAllocationPrice.referenceId()).contains("reference_id") } @Test @@ -169,6 +171,7 @@ internal class NewPlanPackageWithAllocationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanPackageWithAllocationPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithTieredPricingPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithTieredPricingPriceTest.kt index 75cb11a3..c08b0d27 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithTieredPricingPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithTieredPricingPriceTest.kt @@ -62,6 +62,7 @@ internal class NewPlanScalableMatrixWithTieredPricingPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanScalableMatrixWithTieredPricingPrice.cadence()) @@ -130,6 +131,8 @@ internal class NewPlanScalableMatrixWithTieredPricingPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanScalableMatrixWithTieredPricingPrice.referenceId()) + .contains("reference_id") } @Test @@ -185,6 +188,7 @@ internal class NewPlanScalableMatrixWithTieredPricingPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanScalableMatrixWithTieredPricingPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithUnitPricingPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithUnitPricingPriceTest.kt index 5ab592a2..c5a04e9c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithUnitPricingPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanScalableMatrixWithUnitPricingPriceTest.kt @@ -61,6 +61,7 @@ internal class NewPlanScalableMatrixWithUnitPricingPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanScalableMatrixWithUnitPricingPrice.cadence()) @@ -127,6 +128,7 @@ internal class NewPlanScalableMatrixWithUnitPricingPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanScalableMatrixWithUnitPricingPrice.referenceId()).contains("reference_id") } @Test @@ -181,6 +183,7 @@ internal class NewPlanScalableMatrixWithUnitPricingPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanScalableMatrixWithUnitPricingPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanThresholdTotalAmountPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanThresholdTotalAmountPriceTest.kt index baf05d3a..5f37e919 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanThresholdTotalAmountPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanThresholdTotalAmountPriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanThresholdTotalAmountPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanThresholdTotalAmountPrice.cadence()) @@ -118,6 +119,7 @@ internal class NewPlanThresholdTotalAmountPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanThresholdTotalAmountPrice.referenceId()).contains("reference_id") } @Test @@ -168,6 +170,7 @@ internal class NewPlanThresholdTotalAmountPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanThresholdTotalAmountPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTierWithProrationPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTierWithProrationPriceTest.kt index 8326cf27..31c2f2b2 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTierWithProrationPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTierWithProrationPriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanTierWithProrationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanTierWithProrationPrice.cadence()) @@ -117,6 +118,7 @@ internal class NewPlanTierWithProrationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanTierWithProrationPrice.referenceId()).contains("reference_id") } @Test @@ -167,6 +169,7 @@ internal class NewPlanTierWithProrationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanTierWithProrationPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredBpsPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredBpsPriceTest.kt index b7789c08..49da8a9e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredBpsPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredBpsPriceTest.kt @@ -64,6 +64,7 @@ internal class NewPlanTieredBpsPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanTieredBpsPrice.cadence()).isEqualTo(NewPlanTieredBpsPrice.Cadence.ANNUAL) @@ -130,6 +131,7 @@ internal class NewPlanTieredBpsPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanTieredBpsPrice.referenceId()).contains("reference_id") } @Test @@ -187,6 +189,7 @@ internal class NewPlanTieredBpsPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanTieredBpsPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredPackagePriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredPackagePriceTest.kt index 465de725..6c7dca1d 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredPackagePriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredPackagePriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanTieredPackagePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanTieredPackagePrice.cadence()) @@ -117,6 +118,7 @@ internal class NewPlanTieredPackagePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanTieredPackagePrice.referenceId()).contains("reference_id") } @Test @@ -167,6 +169,7 @@ internal class NewPlanTieredPackagePriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanTieredPackagePrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredPackageWithMinimumPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredPackageWithMinimumPriceTest.kt index d3dca1c7..21509959 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredPackageWithMinimumPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredPackageWithMinimumPriceTest.kt @@ -59,6 +59,7 @@ internal class NewPlanTieredPackageWithMinimumPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanTieredPackageWithMinimumPrice.cadence()) @@ -121,6 +122,7 @@ internal class NewPlanTieredPackageWithMinimumPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanTieredPackageWithMinimumPrice.referenceId()).contains("reference_id") } @Test @@ -173,6 +175,7 @@ internal class NewPlanTieredPackageWithMinimumPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanTieredPackageWithMinimumPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredPriceTest.kt index 2d2dd5ea..893703a8 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredPriceTest.kt @@ -63,6 +63,7 @@ internal class NewPlanTieredPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanTieredPrice.cadence()).isEqualTo(NewPlanTieredPrice.Cadence.ANNUAL) @@ -127,6 +128,7 @@ internal class NewPlanTieredPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanTieredPrice.referenceId()).contains("reference_id") } @Test @@ -183,6 +185,7 @@ internal class NewPlanTieredPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanTieredPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredWithMinimumPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredWithMinimumPriceTest.kt index 77c4e66f..16f2e708 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredWithMinimumPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanTieredWithMinimumPriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanTieredWithMinimumPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanTieredWithMinimumPrice.cadence()) @@ -117,6 +118,7 @@ internal class NewPlanTieredWithMinimumPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanTieredWithMinimumPrice.referenceId()).contains("reference_id") } @Test @@ -167,6 +169,7 @@ internal class NewPlanTieredWithMinimumPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanTieredWithMinimumPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanUnitPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanUnitPriceTest.kt index e0e44f10..d53af649 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanUnitPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanUnitPriceTest.kt @@ -53,6 +53,7 @@ internal class NewPlanUnitPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanUnitPrice.cadence()).isEqualTo(NewPlanUnitPrice.Cadence.ANNUAL) @@ -107,6 +108,7 @@ internal class NewPlanUnitPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanUnitPrice.referenceId()).contains("reference_id") } @Test @@ -153,6 +155,7 @@ internal class NewPlanUnitPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanUnitPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanUnitWithPercentPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanUnitWithPercentPriceTest.kt index 883b0fc4..969304cd 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanUnitWithPercentPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanUnitWithPercentPriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanUnitWithPercentPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanUnitWithPercentPrice.cadence()) @@ -117,6 +118,7 @@ internal class NewPlanUnitWithPercentPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanUnitWithPercentPrice.referenceId()).contains("reference_id") } @Test @@ -167,6 +169,7 @@ internal class NewPlanUnitWithPercentPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanUnitWithPercentPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanUnitWithProrationPriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanUnitWithProrationPriceTest.kt index 2c41d63b..8b6987b4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanUnitWithProrationPriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/NewPlanUnitWithProrationPriceTest.kt @@ -57,6 +57,7 @@ internal class NewPlanUnitWithProrationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() assertThat(newPlanUnitWithProrationPrice.cadence()) @@ -117,6 +118,7 @@ internal class NewPlanUnitWithProrationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + assertThat(newPlanUnitWithProrationPrice.referenceId()).contains("reference_id") } @Test @@ -167,6 +169,7 @@ internal class NewPlanUnitWithProrationPriceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() val roundtrippedNewPlanUnitWithProrationPrice = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PerPriceCostTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PerPriceCostTest.kt index cf384816..510507c6 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PerPriceCostTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PerPriceCostTest.kt @@ -105,6 +105,7 @@ internal class PerPriceCostTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -212,6 +213,7 @@ internal class PerPriceCostTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -323,6 +325,7 @@ internal class PerPriceCostTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() 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 5bf1bd12..e3b7f2f1 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 @@ -3,6 +3,7 @@ package com.withorb.api.models import com.withorb.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,46 +15,96 @@ internal class PlanCreateParamsTest { .currency("currency") .name("name") .addPrice( - NewPlanUnitPrice.builder() - .cadence(NewPlanUnitPrice.Cadence.ANNUAL) - .itemId("item_id") - .modelType(NewPlanUnitPrice.ModelType.UNIT) - .name("Annual fee") - .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) - .billableMetricId("billable_metric_id") - .billedInAdvance(true) - .billingCycleConfiguration( - NewBillingCycleConfiguration.builder() - .duration(0L) - .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) + PlanCreateParams.Price.builder() + .allocationPrice( + NewAllocationPrice.builder() + .amount("10.00") + .cadence(NewAllocationPrice.Cadence.MONTHLY) + .currency("USD") + .customExpiration( + CustomExpiration.builder() + .duration(0L) + .durationUnit(CustomExpiration.DurationUnit.DAY) + .build() + ) + .expiresAtEndOfCadence(true) .build() ) - .conversionRate(0.0) - .unitConversionRateConfig( - ConversionRateUnitConfig.builder().unitAmount("unit_amount").build() - ) - .currency("currency") - .dimensionalPriceConfiguration( - NewDimensionalPriceConfiguration.builder() - .addDimensionValue("string") - .dimensionalPriceGroupId("dimensional_price_group_id") - .externalDimensionalPriceGroupId("external_dimensional_price_group_id") - .build() - ) - .externalPriceId("external_price_id") - .fixedPriceQuantity(0.0) - .invoiceGroupingKey("x") - .invoicingCycleConfiguration( - NewBillingCycleConfiguration.builder() - .duration(0L) - .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) + .planPhaseOrder(0L) + .price( + NewPlanUnitPrice.builder() + .cadence(NewPlanUnitPrice.Cadence.ANNUAL) + .itemId("item_id") + .modelType(NewPlanUnitPrice.ModelType.UNIT) + .name("Annual fee") + .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + NewBillingCycleConfiguration.builder() + .duration(0L) + .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) + .build() + ) + .conversionRate(0.0) + .unitConversionRateConfig( + ConversionRateUnitConfig.builder().unitAmount("unit_amount").build() + ) + .currency("currency") + .dimensionalPriceConfiguration( + NewDimensionalPriceConfiguration.builder() + .addDimensionValue("string") + .dimensionalPriceGroupId("dimensional_price_group_id") + .externalDimensionalPriceGroupId( + "external_dimensional_price_group_id" + ) + .build() + ) + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("x") + .invoicingCycleConfiguration( + NewBillingCycleConfiguration.builder() + .duration(0L) + .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) + .build() + ) + .metadata( + NewPlanUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .referenceId("reference_id") .build() ) - .metadata( - NewPlanUnitPrice.Metadata.builder() - .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .addAdjustment( + PlanCreateParams.Adjustment.builder() + .adjustment( + NewPercentageDiscount.builder() + .adjustmentType( + NewPercentageDiscount.AdjustmentType.PERCENTAGE_DISCOUNT + ) + .percentageDiscount(0.0) + .appliesToAll(NewPercentageDiscount.AppliesToAll.TRUE) + .addAppliesToItemId("item_1") + .addAppliesToItemId("item_2") + .addAppliesToPriceId("price_1") + .addAppliesToPriceId("price_2") + .currency("currency") + .addFilter( + TransformPriceFilter.builder() + .field(TransformPriceFilter.Field.PRICE_ID) + .operator(TransformPriceFilter.Operator.INCLUDES) + .addValue("string") + .build() + ) + .isInvoiceLevel(true) + .priceType(NewPercentageDiscount.PriceType.USAGE) .build() ) + .planPhaseOrder(0L) .build() ) .defaultInvoiceMemo("default_invoice_memo") @@ -64,6 +115,14 @@ internal class PlanCreateParamsTest { .build() ) .netTerms(0L) + .addPlanPhase( + PlanCreateParams.PlanPhase.builder() + .order(0L) + .alignBillingWithPhaseStartDate(true) + .duration(1L) + .durationUnit(PlanCreateParams.PlanPhase.DurationUnit.DAILY) + .build() + ) .status(PlanCreateParams.Status.ACTIVE) .build() } @@ -75,48 +134,98 @@ internal class PlanCreateParamsTest { .currency("currency") .name("name") .addPrice( - NewPlanUnitPrice.builder() - .cadence(NewPlanUnitPrice.Cadence.ANNUAL) - .itemId("item_id") - .modelType(NewPlanUnitPrice.ModelType.UNIT) - .name("Annual fee") - .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) - .billableMetricId("billable_metric_id") - .billedInAdvance(true) - .billingCycleConfiguration( - NewBillingCycleConfiguration.builder() - .duration(0L) - .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) - .build() - ) - .conversionRate(0.0) - .unitConversionRateConfig( - ConversionRateUnitConfig.builder().unitAmount("unit_amount").build() - ) - .currency("currency") - .dimensionalPriceConfiguration( - NewDimensionalPriceConfiguration.builder() - .addDimensionValue("string") - .dimensionalPriceGroupId("dimensional_price_group_id") - .externalDimensionalPriceGroupId( - "external_dimensional_price_group_id" + PlanCreateParams.Price.builder() + .allocationPrice( + NewAllocationPrice.builder() + .amount("10.00") + .cadence(NewAllocationPrice.Cadence.MONTHLY) + .currency("USD") + .customExpiration( + CustomExpiration.builder() + .duration(0L) + .durationUnit(CustomExpiration.DurationUnit.DAY) + .build() ) + .expiresAtEndOfCadence(true) .build() ) - .externalPriceId("external_price_id") - .fixedPriceQuantity(0.0) - .invoiceGroupingKey("x") - .invoicingCycleConfiguration( - NewBillingCycleConfiguration.builder() - .duration(0L) - .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) + .planPhaseOrder(0L) + .price( + NewPlanUnitPrice.builder() + .cadence(NewPlanUnitPrice.Cadence.ANNUAL) + .itemId("item_id") + .modelType(NewPlanUnitPrice.ModelType.UNIT) + .name("Annual fee") + .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + NewBillingCycleConfiguration.builder() + .duration(0L) + .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) + .build() + ) + .conversionRate(0.0) + .unitConversionRateConfig( + ConversionRateUnitConfig.builder() + .unitAmount("unit_amount") + .build() + ) + .currency("currency") + .dimensionalPriceConfiguration( + NewDimensionalPriceConfiguration.builder() + .addDimensionValue("string") + .dimensionalPriceGroupId("dimensional_price_group_id") + .externalDimensionalPriceGroupId( + "external_dimensional_price_group_id" + ) + .build() + ) + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("x") + .invoicingCycleConfiguration( + NewBillingCycleConfiguration.builder() + .duration(0L) + .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) + .build() + ) + .metadata( + NewPlanUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .referenceId("reference_id") .build() ) - .metadata( - NewPlanUnitPrice.Metadata.builder() - .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .addAdjustment( + PlanCreateParams.Adjustment.builder() + .adjustment( + NewPercentageDiscount.builder() + .adjustmentType( + NewPercentageDiscount.AdjustmentType.PERCENTAGE_DISCOUNT + ) + .percentageDiscount(0.0) + .appliesToAll(NewPercentageDiscount.AppliesToAll.TRUE) + .addAppliesToItemId("item_1") + .addAppliesToItemId("item_2") + .addAppliesToPriceId("price_1") + .addAppliesToPriceId("price_2") + .currency("currency") + .addFilter( + TransformPriceFilter.builder() + .field(TransformPriceFilter.Field.PRICE_ID) + .operator(TransformPriceFilter.Operator.INCLUDES) + .addValue("string") + .build() + ) + .isInvoiceLevel(true) + .priceType(NewPercentageDiscount.PriceType.USAGE) .build() ) + .planPhaseOrder(0L) .build() ) .defaultInvoiceMemo("default_invoice_memo") @@ -127,6 +236,14 @@ internal class PlanCreateParamsTest { .build() ) .netTerms(0L) + .addPlanPhase( + PlanCreateParams.PlanPhase.builder() + .order(0L) + .alignBillingWithPhaseStartDate(true) + .duration(1L) + .durationUnit(PlanCreateParams.PlanPhase.DurationUnit.DAILY) + .build() + ) .status(PlanCreateParams.Status.ACTIVE) .build() @@ -136,51 +253,98 @@ internal class PlanCreateParamsTest { assertThat(body.name()).isEqualTo("name") assertThat(body.prices()) .containsExactly( - PlanCreateParams.Price.ofUnit( - NewPlanUnitPrice.builder() - .cadence(NewPlanUnitPrice.Cadence.ANNUAL) - .itemId("item_id") - .modelType(NewPlanUnitPrice.ModelType.UNIT) - .name("Annual fee") - .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) - .billableMetricId("billable_metric_id") - .billedInAdvance(true) - .billingCycleConfiguration( - NewBillingCycleConfiguration.builder() - .duration(0L) - .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) - .build() - ) - .conversionRate(0.0) - .unitConversionRateConfig( - ConversionRateUnitConfig.builder().unitAmount("unit_amount").build() - ) - .currency("currency") - .dimensionalPriceConfiguration( - NewDimensionalPriceConfiguration.builder() - .addDimensionValue("string") - .dimensionalPriceGroupId("dimensional_price_group_id") - .externalDimensionalPriceGroupId( - "external_dimensional_price_group_id" - ) - .build() - ) - .externalPriceId("external_price_id") - .fixedPriceQuantity(0.0) - .invoiceGroupingKey("x") - .invoicingCycleConfiguration( - NewBillingCycleConfiguration.builder() - .duration(0L) - .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) - .build() - ) - .metadata( - NewPlanUnitPrice.Metadata.builder() - .putAdditionalProperty("foo", JsonValue.from("string")) - .build() - ) - .build() - ) + PlanCreateParams.Price.builder() + .allocationPrice( + NewAllocationPrice.builder() + .amount("10.00") + .cadence(NewAllocationPrice.Cadence.MONTHLY) + .currency("USD") + .customExpiration( + CustomExpiration.builder() + .duration(0L) + .durationUnit(CustomExpiration.DurationUnit.DAY) + .build() + ) + .expiresAtEndOfCadence(true) + .build() + ) + .planPhaseOrder(0L) + .price( + NewPlanUnitPrice.builder() + .cadence(NewPlanUnitPrice.Cadence.ANNUAL) + .itemId("item_id") + .modelType(NewPlanUnitPrice.ModelType.UNIT) + .name("Annual fee") + .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + NewBillingCycleConfiguration.builder() + .duration(0L) + .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) + .build() + ) + .conversionRate(0.0) + .unitConversionRateConfig( + ConversionRateUnitConfig.builder().unitAmount("unit_amount").build() + ) + .currency("currency") + .dimensionalPriceConfiguration( + NewDimensionalPriceConfiguration.builder() + .addDimensionValue("string") + .dimensionalPriceGroupId("dimensional_price_group_id") + .externalDimensionalPriceGroupId( + "external_dimensional_price_group_id" + ) + .build() + ) + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("x") + .invoicingCycleConfiguration( + NewBillingCycleConfiguration.builder() + .duration(0L) + .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) + .build() + ) + .metadata( + NewPlanUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .referenceId("reference_id") + .build() + ) + .build() + ) + assertThat(body.adjustments().getOrNull()) + .containsExactly( + PlanCreateParams.Adjustment.builder() + .adjustment( + NewPercentageDiscount.builder() + .adjustmentType( + NewPercentageDiscount.AdjustmentType.PERCENTAGE_DISCOUNT + ) + .percentageDiscount(0.0) + .appliesToAll(NewPercentageDiscount.AppliesToAll.TRUE) + .addAppliesToItemId("item_1") + .addAppliesToItemId("item_2") + .addAppliesToPriceId("price_1") + .addAppliesToPriceId("price_2") + .currency("currency") + .addFilter( + TransformPriceFilter.builder() + .field(TransformPriceFilter.Field.PRICE_ID) + .operator(TransformPriceFilter.Operator.INCLUDES) + .addValue("string") + .build() + ) + .isInvoiceLevel(true) + .priceType(NewPercentageDiscount.PriceType.USAGE) + .build() + ) + .planPhaseOrder(0L) + .build() ) assertThat(body.defaultInvoiceMemo()).contains("default_invoice_memo") assertThat(body.externalPlanId()).contains("external_plan_id") @@ -191,6 +355,15 @@ internal class PlanCreateParamsTest { .build() ) assertThat(body.netTerms()).contains(0L) + assertThat(body.planPhases().getOrNull()) + .containsExactly( + PlanCreateParams.PlanPhase.builder() + .order(0L) + .alignBillingWithPhaseStartDate(true) + .duration(1L) + .durationUnit(PlanCreateParams.PlanPhase.DurationUnit.DAILY) + .build() + ) assertThat(body.status()).contains(PlanCreateParams.Status.ACTIVE) } @@ -200,32 +373,13 @@ internal class PlanCreateParamsTest { PlanCreateParams.builder() .currency("currency") .name("name") - .addPrice( - NewPlanUnitPrice.builder() - .cadence(NewPlanUnitPrice.Cadence.ANNUAL) - .itemId("item_id") - .modelType(NewPlanUnitPrice.ModelType.UNIT) - .name("Annual fee") - .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) - .build() - ) + .addPrice(PlanCreateParams.Price.builder().build()) .build() val body = params._body() assertThat(body.currency()).isEqualTo("currency") assertThat(body.name()).isEqualTo("name") - assertThat(body.prices()) - .containsExactly( - PlanCreateParams.Price.ofUnit( - NewPlanUnitPrice.builder() - .cadence(NewPlanUnitPrice.Cadence.ANNUAL) - .itemId("item_id") - .modelType(NewPlanUnitPrice.ModelType.UNIT) - .name("Annual fee") - .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) - .build() - ) - ) + assertThat(body.prices()).containsExactly(PlanCreateParams.Price.builder().build()) } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanListPageResponseTest.kt index 051ad75c..c54feb68 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanListPageResponseTest.kt @@ -35,6 +35,7 @@ internal class PlanListPageResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -249,6 +250,7 @@ internal class PlanListPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -301,6 +303,7 @@ internal class PlanListPageResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -513,6 +516,7 @@ internal class PlanListPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -568,6 +572,7 @@ internal class PlanListPageResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -782,6 +787,7 @@ internal class PlanListPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseAmountDiscountAdjustmentTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseAmountDiscountAdjustmentTest.kt index 7452ff53..fa9cb936 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseAmountDiscountAdjustmentTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseAmountDiscountAdjustmentTest.kt @@ -27,6 +27,7 @@ internal class PlanPhaseAmountDiscountAdjustmentTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() assertThat(planPhaseAmountDiscountAdjustment.id()).isEqualTo("id") @@ -45,6 +46,8 @@ internal class PlanPhaseAmountDiscountAdjustmentTest { assertThat(planPhaseAmountDiscountAdjustment.isInvoiceLevel()).isEqualTo(true) assertThat(planPhaseAmountDiscountAdjustment.planPhaseOrder()).contains(0L) assertThat(planPhaseAmountDiscountAdjustment.reason()).contains("reason") + assertThat(planPhaseAmountDiscountAdjustment.replacesAdjustmentId()) + .contains("replaces_adjustment_id") } @Test @@ -66,6 +69,7 @@ internal class PlanPhaseAmountDiscountAdjustmentTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() val roundtrippedPlanPhaseAmountDiscountAdjustment = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseMaximumAdjustmentTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseMaximumAdjustmentTest.kt index f4547aa1..8dfe74fd 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseMaximumAdjustmentTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseMaximumAdjustmentTest.kt @@ -27,6 +27,7 @@ internal class PlanPhaseMaximumAdjustmentTest { .maximumAmount("maximum_amount") .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() assertThat(planPhaseMaximumAdjustment.id()).isEqualTo("id") @@ -45,6 +46,8 @@ internal class PlanPhaseMaximumAdjustmentTest { assertThat(planPhaseMaximumAdjustment.maximumAmount()).isEqualTo("maximum_amount") assertThat(planPhaseMaximumAdjustment.planPhaseOrder()).contains(0L) assertThat(planPhaseMaximumAdjustment.reason()).contains("reason") + assertThat(planPhaseMaximumAdjustment.replacesAdjustmentId()) + .contains("replaces_adjustment_id") } @Test @@ -66,6 +69,7 @@ internal class PlanPhaseMaximumAdjustmentTest { .maximumAmount("maximum_amount") .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() val roundtrippedPlanPhaseMaximumAdjustment = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseMinimumAdjustmentTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseMinimumAdjustmentTest.kt index 45dd8d41..0c1af0a2 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseMinimumAdjustmentTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseMinimumAdjustmentTest.kt @@ -28,6 +28,7 @@ internal class PlanPhaseMinimumAdjustmentTest { .minimumAmount("minimum_amount") .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() assertThat(planPhaseMinimumAdjustment.id()).isEqualTo("id") @@ -47,6 +48,8 @@ internal class PlanPhaseMinimumAdjustmentTest { assertThat(planPhaseMinimumAdjustment.minimumAmount()).isEqualTo("minimum_amount") assertThat(planPhaseMinimumAdjustment.planPhaseOrder()).contains(0L) assertThat(planPhaseMinimumAdjustment.reason()).contains("reason") + assertThat(planPhaseMinimumAdjustment.replacesAdjustmentId()) + .contains("replaces_adjustment_id") } @Test @@ -69,6 +72,7 @@ internal class PlanPhaseMinimumAdjustmentTest { .minimumAmount("minimum_amount") .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() val roundtrippedPlanPhaseMinimumAdjustment = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhasePercentageDiscountAdjustmentTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhasePercentageDiscountAdjustmentTest.kt index 78d49912..2841694e 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhasePercentageDiscountAdjustmentTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhasePercentageDiscountAdjustmentTest.kt @@ -29,6 +29,7 @@ internal class PlanPhasePercentageDiscountAdjustmentTest { .percentageDiscount(0.0) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() assertThat(planPhasePercentageDiscountAdjustment.id()).isEqualTo("id") @@ -48,6 +49,8 @@ internal class PlanPhasePercentageDiscountAdjustmentTest { assertThat(planPhasePercentageDiscountAdjustment.percentageDiscount()).isEqualTo(0.0) assertThat(planPhasePercentageDiscountAdjustment.planPhaseOrder()).contains(0L) assertThat(planPhasePercentageDiscountAdjustment.reason()).contains("reason") + assertThat(planPhasePercentageDiscountAdjustment.replacesAdjustmentId()) + .contains("replaces_adjustment_id") } @Test @@ -71,6 +74,7 @@ internal class PlanPhasePercentageDiscountAdjustmentTest { .percentageDiscount(0.0) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .build() val roundtrippedPlanPhasePercentageDiscountAdjustment = diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseUsageDiscountAdjustmentTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseUsageDiscountAdjustmentTest.kt index 4ddc6e0e..abc7c22a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseUsageDiscountAdjustmentTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanPhaseUsageDiscountAdjustmentTest.kt @@ -26,6 +26,7 @@ internal class PlanPhaseUsageDiscountAdjustmentTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() @@ -44,6 +45,8 @@ internal class PlanPhaseUsageDiscountAdjustmentTest { assertThat(planPhaseUsageDiscountAdjustment.isInvoiceLevel()).isEqualTo(true) assertThat(planPhaseUsageDiscountAdjustment.planPhaseOrder()).contains(0L) assertThat(planPhaseUsageDiscountAdjustment.reason()).contains("reason") + assertThat(planPhaseUsageDiscountAdjustment.replacesAdjustmentId()) + .contains("replaces_adjustment_id") assertThat(planPhaseUsageDiscountAdjustment.usageDiscount()).isEqualTo(0.0) } @@ -65,6 +68,7 @@ internal class PlanPhaseUsageDiscountAdjustmentTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt index 67e8be06..e13a2832 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanTest.kt @@ -34,6 +34,7 @@ internal class PlanTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -246,6 +247,7 @@ internal class PlanTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -292,6 +294,7 @@ internal class PlanTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -515,6 +518,7 @@ internal class PlanTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -567,6 +571,7 @@ internal class PlanTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -779,6 +784,7 @@ internal class PlanTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanVersionTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanVersionTest.kt index 6e24ffa4..5b8c6148 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanVersionTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PlanVersionTest.kt @@ -33,6 +33,7 @@ internal class PlanVersionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -137,6 +138,7 @@ internal class PlanVersionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -168,6 +170,7 @@ internal class PlanVersionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -277,6 +280,7 @@ internal class PlanVersionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -312,6 +316,7 @@ internal class PlanVersionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -416,6 +421,7 @@ internal class PlanVersionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceIntervalTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceIntervalTest.kt index f30d3c95..0c829855 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceIntervalTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceIntervalTest.kt @@ -119,6 +119,7 @@ internal class PriceIntervalTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -241,6 +242,7 @@ internal class PriceIntervalTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -364,6 +366,7 @@ internal class PriceIntervalTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceListPageResponseTest.kt index 0ebe0055..fcecceb0 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceListPageResponseTest.kt @@ -105,6 +105,7 @@ internal class PriceListPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -211,6 +212,7 @@ internal class PriceListPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -320,6 +322,7 @@ internal class PriceListPageResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceTest.kt index fecf8446..a3ea6229 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceTest.kt @@ -107,6 +107,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -242,6 +243,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -353,6 +355,7 @@ internal class PriceTest { ) .planPhaseOrder(0L) .priceType(Price.Package.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -493,6 +496,7 @@ internal class PriceTest { ) .planPhaseOrder(0L) .priceType(Price.Package.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -612,6 +616,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Matrix.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -758,6 +763,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Matrix.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -865,6 +871,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Tiered.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .tieredConfig( TieredConfig.builder() .addTier( @@ -1010,6 +1017,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Tiered.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .tieredConfig( TieredConfig.builder() .addTier( @@ -1128,6 +1136,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.TieredBps.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .tieredBpsConfig( TieredBpsConfig.builder() .addTier( @@ -1274,6 +1283,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.TieredBps.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .tieredBpsConfig( TieredBpsConfig.builder() .addTier( @@ -1394,6 +1404,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Bps.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -1531,6 +1542,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Bps.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -1649,6 +1661,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.BulkBps.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -1794,6 +1807,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.BulkBps.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -1908,6 +1922,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Bulk.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -2052,6 +2067,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Bulk.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -2159,6 +2175,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.ThresholdTotalAmount.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .thresholdTotalAmountConfig( Price.ThresholdTotalAmount.ThresholdTotalAmountConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -2298,6 +2315,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.ThresholdTotalAmount.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .thresholdTotalAmountConfig( Price.ThresholdTotalAmount.ThresholdTotalAmountConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -2410,6 +2428,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.TieredPackage.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .tieredPackageConfig( Price.TieredPackage.TieredPackageConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -2549,6 +2568,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.TieredPackage.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .tieredPackageConfig( Price.TieredPackage.TieredPackageConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -2666,6 +2686,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedTiered.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -2805,6 +2826,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedTiered.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -2912,6 +2934,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.TieredWithMinimum.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .tieredWithMinimumConfig( Price.TieredWithMinimum.TieredWithMinimumConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -3051,6 +3074,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.TieredWithMinimum.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .tieredWithMinimumConfig( Price.TieredWithMinimum.TieredWithMinimumConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -3163,6 +3187,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.TieredPackageWithMinimum.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .tieredPackageWithMinimumConfig( Price.TieredPackageWithMinimum.TieredPackageWithMinimumConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -3302,6 +3327,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.TieredPackageWithMinimum.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .tieredPackageWithMinimumConfig( Price.TieredPackageWithMinimum.TieredPackageWithMinimumConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -3419,6 +3445,7 @@ internal class PriceTest { ) .planPhaseOrder(0L) .priceType(Price.PackageWithAllocation.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -3558,6 +3585,7 @@ internal class PriceTest { ) .planPhaseOrder(0L) .priceType(Price.PackageWithAllocation.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -3665,6 +3693,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.UnitWithPercent.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitWithPercentConfig( Price.UnitWithPercent.UnitWithPercentConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -3804,6 +3833,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.UnitWithPercent.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitWithPercentConfig( Price.UnitWithPercent.UnitWithPercentConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -3929,6 +3959,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.MatrixWithAllocation.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -4076,6 +4107,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.MatrixWithAllocation.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -4183,6 +4215,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.TieredWithProration.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .tieredWithProrationConfig( Price.TieredWithProration.TieredWithProrationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -4322,6 +4355,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.TieredWithProration.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .tieredWithProrationConfig( Price.TieredWithProration.TieredWithProrationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -4434,6 +4468,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.UnitWithProration.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitWithProrationConfig( Price.UnitWithProration.UnitWithProrationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -4573,6 +4608,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.UnitWithProration.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitWithProrationConfig( Price.UnitWithProration.UnitWithProrationConfig.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) @@ -4690,6 +4726,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedAllocation.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -4829,6 +4866,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedAllocation.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -4941,6 +4979,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedWithProratedMinimum.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -5080,6 +5119,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedWithProratedMinimum.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -5192,6 +5232,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedWithMeteredMinimum.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -5331,6 +5372,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedWithMeteredMinimum.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -5443,6 +5485,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.MatrixWithDisplayName.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -5582,6 +5625,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.MatrixWithDisplayName.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -5694,6 +5738,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.BulkWithProration.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -5833,6 +5878,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.BulkWithProration.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -5945,6 +5991,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedTieredPackage.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -6084,6 +6131,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.GroupedTieredPackage.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -6196,6 +6244,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.MaxGroupTieredPackage.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -6335,6 +6384,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.MaxGroupTieredPackage.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -6442,6 +6492,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.ScalableMatrixWithUnitPricing.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .scalableMatrixWithUnitPricingConfig( Price.ScalableMatrixWithUnitPricing.ScalableMatrixWithUnitPricingConfig .builder() @@ -6582,6 +6633,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.ScalableMatrixWithUnitPricing.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .scalableMatrixWithUnitPricingConfig( Price.ScalableMatrixWithUnitPricing.ScalableMatrixWithUnitPricingConfig .builder() @@ -6695,6 +6747,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.ScalableMatrixWithTieredPricing.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .scalableMatrixWithTieredPricingConfig( Price.ScalableMatrixWithTieredPricing.ScalableMatrixWithTieredPricingConfig .builder() @@ -6836,6 +6889,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.ScalableMatrixWithTieredPricing.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .scalableMatrixWithTieredPricingConfig( Price.ScalableMatrixWithTieredPricing.ScalableMatrixWithTieredPricingConfig .builder() @@ -6954,6 +7008,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.CumulativeGroupedBulk.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") @@ -7093,6 +7148,7 @@ internal class PriceTest { .name("name") .planPhaseOrder(0L) .priceType(Price.CumulativeGroupedBulk.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() .addDimensionValue("string") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt index ea05cdf0..85791e17 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt @@ -43,6 +43,7 @@ internal class SubscriptionChangeApplyResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -242,6 +243,7 @@ internal class SubscriptionChangeApplyResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -483,6 +485,7 @@ internal class SubscriptionChangeApplyResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -645,6 +648,7 @@ internal class SubscriptionChangeApplyResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -922,6 +926,9 @@ internal class SubscriptionChangeApplyResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId( + "replaces_adjustment_id" + ) .usageDiscount(0.0) .build() ) @@ -1152,6 +1159,7 @@ internal class SubscriptionChangeApplyResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -1537,6 +1545,9 @@ internal class SubscriptionChangeApplyResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId( + "replaces_adjustment_id" + ) .usageDiscount(0.0) .build() ) @@ -1767,6 +1778,7 @@ internal class SubscriptionChangeApplyResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -1947,6 +1959,7 @@ internal class SubscriptionChangeApplyResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2138,6 +2151,7 @@ internal class SubscriptionChangeApplyResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2372,6 +2386,7 @@ internal class SubscriptionChangeApplyResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -2523,6 +2538,7 @@ internal class SubscriptionChangeApplyResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -2778,6 +2794,7 @@ internal class SubscriptionChangeApplyResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2995,6 +3012,7 @@ internal class SubscriptionChangeApplyResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -3353,6 +3371,7 @@ internal class SubscriptionChangeApplyResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -3570,6 +3589,7 @@ internal class SubscriptionChangeApplyResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -3747,6 +3767,7 @@ internal class SubscriptionChangeApplyResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -3946,6 +3967,7 @@ internal class SubscriptionChangeApplyResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -4187,6 +4209,7 @@ internal class SubscriptionChangeApplyResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -4349,6 +4372,7 @@ internal class SubscriptionChangeApplyResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -4626,6 +4650,9 @@ internal class SubscriptionChangeApplyResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId( + "replaces_adjustment_id" + ) .usageDiscount(0.0) .build() ) @@ -4856,6 +4883,7 @@ internal class SubscriptionChangeApplyResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -5241,6 +5269,9 @@ internal class SubscriptionChangeApplyResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId( + "replaces_adjustment_id" + ) .usageDiscount(0.0) .build() ) @@ -5471,6 +5502,7 @@ internal class SubscriptionChangeApplyResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt index 50f31cbf..93f7574a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt @@ -43,6 +43,7 @@ internal class SubscriptionChangeCancelResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -242,6 +243,7 @@ internal class SubscriptionChangeCancelResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -483,6 +485,7 @@ internal class SubscriptionChangeCancelResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -645,6 +648,7 @@ internal class SubscriptionChangeCancelResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -922,6 +926,9 @@ internal class SubscriptionChangeCancelResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId( + "replaces_adjustment_id" + ) .usageDiscount(0.0) .build() ) @@ -1152,6 +1159,7 @@ internal class SubscriptionChangeCancelResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -1537,6 +1545,9 @@ internal class SubscriptionChangeCancelResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId( + "replaces_adjustment_id" + ) .usageDiscount(0.0) .build() ) @@ -1767,6 +1778,7 @@ internal class SubscriptionChangeCancelResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -1947,6 +1959,7 @@ internal class SubscriptionChangeCancelResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2138,6 +2151,7 @@ internal class SubscriptionChangeCancelResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2372,6 +2386,7 @@ internal class SubscriptionChangeCancelResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -2523,6 +2538,7 @@ internal class SubscriptionChangeCancelResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -2778,6 +2794,7 @@ internal class SubscriptionChangeCancelResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2995,6 +3012,7 @@ internal class SubscriptionChangeCancelResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -3353,6 +3371,7 @@ internal class SubscriptionChangeCancelResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -3570,6 +3589,7 @@ internal class SubscriptionChangeCancelResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -3747,6 +3767,7 @@ internal class SubscriptionChangeCancelResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -3946,6 +3967,7 @@ internal class SubscriptionChangeCancelResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -4187,6 +4209,7 @@ internal class SubscriptionChangeCancelResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -4349,6 +4372,7 @@ internal class SubscriptionChangeCancelResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -4626,6 +4650,9 @@ internal class SubscriptionChangeCancelResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId( + "replaces_adjustment_id" + ) .usageDiscount(0.0) .build() ) @@ -4856,6 +4883,7 @@ internal class SubscriptionChangeCancelResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -5241,6 +5269,9 @@ internal class SubscriptionChangeCancelResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId( + "replaces_adjustment_id" + ) .usageDiscount(0.0) .build() ) @@ -5471,6 +5502,7 @@ internal class SubscriptionChangeCancelResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt index c7a89441..6b0bd030 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt @@ -43,6 +43,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -242,6 +243,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -483,6 +485,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -645,6 +648,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -922,6 +926,9 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId( + "replaces_adjustment_id" + ) .usageDiscount(0.0) .build() ) @@ -1152,6 +1159,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -1537,6 +1545,9 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId( + "replaces_adjustment_id" + ) .usageDiscount(0.0) .build() ) @@ -1767,6 +1778,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -1947,6 +1959,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2138,6 +2151,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2372,6 +2386,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -2523,6 +2538,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -2778,6 +2794,7 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -2995,6 +3012,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -3353,6 +3371,7 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -3570,6 +3589,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -3747,6 +3767,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -3946,6 +3967,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -4187,6 +4209,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -4349,6 +4372,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -4626,6 +4650,9 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId( + "replaces_adjustment_id" + ) .usageDiscount(0.0) .build() ) @@ -4856,6 +4883,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") @@ -5241,6 +5269,9 @@ internal class SubscriptionChangeRetrieveResponseTest { ) .isInvoiceLevel(true) .reason("reason") + .replacesAdjustmentId( + "replaces_adjustment_id" + ) .usageDiscount(0.0) .build() ) @@ -5471,6 +5502,7 @@ internal class SubscriptionChangeRetrieveResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder() .unitAmount("unit_amount") 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 c6a3583e..09f8ae0d 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 @@ -130,6 +130,7 @@ internal class SubscriptionFetchCostsResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -266,6 +267,7 @@ internal class SubscriptionFetchCostsResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -411,6 +413,7 @@ internal class SubscriptionFetchCostsResponseTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt index a2b79603..c7eae5d7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionTest.kt @@ -37,6 +37,7 @@ internal class SubscriptionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -224,6 +225,7 @@ internal class SubscriptionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -438,6 +440,7 @@ internal class SubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -575,6 +578,7 @@ internal class SubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -627,6 +631,7 @@ internal class SubscriptionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -826,6 +831,7 @@ internal class SubscriptionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1038,6 +1044,7 @@ internal class SubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -1170,6 +1177,7 @@ internal class SubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -1229,6 +1237,7 @@ internal class SubscriptionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1416,6 +1425,7 @@ internal class SubscriptionTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1630,6 +1640,7 @@ internal class SubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() @@ -1767,6 +1778,7 @@ internal class SubscriptionTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) .dimensionalPriceConfiguration( DimensionalPriceConfiguration.builder() 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 151bc751..6e12850f 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 @@ -40,6 +40,7 @@ internal class SubscriptionsTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -239,6 +240,7 @@ internal class SubscriptionsTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -480,6 +482,7 @@ internal class SubscriptionsTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -642,6 +645,7 @@ internal class SubscriptionsTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -706,6 +710,7 @@ internal class SubscriptionsTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -897,6 +902,7 @@ internal class SubscriptionsTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1131,6 +1137,7 @@ internal class SubscriptionsTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -1282,6 +1289,7 @@ internal class SubscriptionsTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -1347,6 +1355,7 @@ internal class SubscriptionsTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1546,6 +1555,7 @@ internal class SubscriptionsTest { .isInvoiceLevel(true) .planPhaseOrder(0L) .reason("reason") + .replacesAdjustmentId("replaces_adjustment_id") .usageDiscount(0.0) .build() ) @@ -1787,6 +1797,7 @@ internal class SubscriptionsTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) @@ -1949,6 +1960,7 @@ internal class SubscriptionsTest { .name("name") .planPhaseOrder(0L) .priceType(Price.Unit.PriceType.USAGE_PRICE) + .replacesPriceId("replaces_price_id") .unitConfig( UnitConfig.builder().unitAmount("unit_amount").build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/BetaServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/BetaServiceAsyncTest.kt index 3598f125..211883ff 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/BetaServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/BetaServiceAsyncTest.kt @@ -133,6 +133,7 @@ internal class BetaServiceAsyncTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -247,6 +248,7 @@ internal class BetaServiceAsyncTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt index d7ce3749..1902e5b5 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PlanServiceAsyncTest.kt @@ -6,11 +6,15 @@ import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.core.JsonValue import com.withorb.api.models.ConversionRateUnitConfig +import com.withorb.api.models.CustomExpiration +import com.withorb.api.models.NewAllocationPrice import com.withorb.api.models.NewBillingCycleConfiguration import com.withorb.api.models.NewDimensionalPriceConfiguration +import com.withorb.api.models.NewPercentageDiscount import com.withorb.api.models.NewPlanUnitPrice import com.withorb.api.models.PlanCreateParams import com.withorb.api.models.PlanUpdateParams +import com.withorb.api.models.TransformPriceFilter import com.withorb.api.models.UnitConfig import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -33,48 +37,104 @@ internal class PlanServiceAsyncTest { .currency("currency") .name("name") .addPrice( - NewPlanUnitPrice.builder() - .cadence(NewPlanUnitPrice.Cadence.ANNUAL) - .itemId("item_id") - .modelType(NewPlanUnitPrice.ModelType.UNIT) - .name("Annual fee") - .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) - .billableMetricId("billable_metric_id") - .billedInAdvance(true) - .billingCycleConfiguration( - NewBillingCycleConfiguration.builder() - .duration(0L) - .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) - .build() - ) - .conversionRate(0.0) - .unitConversionRateConfig( - ConversionRateUnitConfig.builder().unitAmount("unit_amount").build() - ) - .currency("currency") - .dimensionalPriceConfiguration( - NewDimensionalPriceConfiguration.builder() - .addDimensionValue("string") - .dimensionalPriceGroupId("dimensional_price_group_id") - .externalDimensionalPriceGroupId( - "external_dimensional_price_group_id" + PlanCreateParams.Price.builder() + .allocationPrice( + NewAllocationPrice.builder() + .amount("10.00") + .cadence(NewAllocationPrice.Cadence.MONTHLY) + .currency("USD") + .customExpiration( + CustomExpiration.builder() + .duration(0L) + .durationUnit(CustomExpiration.DurationUnit.DAY) + .build() ) + .expiresAtEndOfCadence(true) .build() ) - .externalPriceId("external_price_id") - .fixedPriceQuantity(0.0) - .invoiceGroupingKey("x") - .invoicingCycleConfiguration( - NewBillingCycleConfiguration.builder() - .duration(0L) - .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) + .planPhaseOrder(0L) + .price( + NewPlanUnitPrice.builder() + .cadence(NewPlanUnitPrice.Cadence.ANNUAL) + .itemId("item_id") + .modelType(NewPlanUnitPrice.ModelType.UNIT) + .name("Annual fee") + .unitConfig( + UnitConfig.builder().unitAmount("unit_amount").build() + ) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + NewBillingCycleConfiguration.builder() + .duration(0L) + .durationUnit( + NewBillingCycleConfiguration.DurationUnit.DAY + ) + .build() + ) + .conversionRate(0.0) + .unitConversionRateConfig( + ConversionRateUnitConfig.builder() + .unitAmount("unit_amount") + .build() + ) + .currency("currency") + .dimensionalPriceConfiguration( + NewDimensionalPriceConfiguration.builder() + .addDimensionValue("string") + .dimensionalPriceGroupId("dimensional_price_group_id") + .externalDimensionalPriceGroupId( + "external_dimensional_price_group_id" + ) + .build() + ) + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("x") + .invoicingCycleConfiguration( + NewBillingCycleConfiguration.builder() + .duration(0L) + .durationUnit( + NewBillingCycleConfiguration.DurationUnit.DAY + ) + .build() + ) + .metadata( + NewPlanUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .referenceId("reference_id") .build() ) - .metadata( - NewPlanUnitPrice.Metadata.builder() - .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .addAdjustment( + PlanCreateParams.Adjustment.builder() + .adjustment( + NewPercentageDiscount.builder() + .adjustmentType( + NewPercentageDiscount.AdjustmentType.PERCENTAGE_DISCOUNT + ) + .percentageDiscount(0.0) + .appliesToAll(NewPercentageDiscount.AppliesToAll.TRUE) + .addAppliesToItemId("item_1") + .addAppliesToItemId("item_2") + .addAppliesToPriceId("price_1") + .addAppliesToPriceId("price_2") + .currency("currency") + .addFilter( + TransformPriceFilter.builder() + .field(TransformPriceFilter.Field.PRICE_ID) + .operator(TransformPriceFilter.Operator.INCLUDES) + .addValue("string") + .build() + ) + .isInvoiceLevel(true) + .priceType(NewPercentageDiscount.PriceType.USAGE) .build() ) + .planPhaseOrder(0L) .build() ) .defaultInvoiceMemo("default_invoice_memo") @@ -85,6 +145,14 @@ internal class PlanServiceAsyncTest { .build() ) .netTerms(0L) + .addPlanPhase( + PlanCreateParams.PlanPhase.builder() + .order(0L) + .alignBillingWithPhaseStartDate(true) + .duration(1L) + .durationUnit(PlanCreateParams.PlanPhase.DurationUnit.DAILY) + .build() + ) .status(PlanCreateParams.Status.ACTIVE) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/beta/ExternalPlanIdServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/beta/ExternalPlanIdServiceAsyncTest.kt index c7852819..ceb716fb 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/beta/ExternalPlanIdServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/beta/ExternalPlanIdServiceAsyncTest.kt @@ -133,6 +133,7 @@ internal class ExternalPlanIdServiceAsyncTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -247,6 +248,7 @@ internal class ExternalPlanIdServiceAsyncTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/BetaServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/BetaServiceTest.kt index 69bd7f29..24e97734 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/BetaServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/BetaServiceTest.kt @@ -133,6 +133,7 @@ internal class BetaServiceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -247,6 +248,7 @@ internal class BetaServiceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt index fa1e9f3d..b3af6064 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PlanServiceTest.kt @@ -6,11 +6,15 @@ import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.core.JsonValue import com.withorb.api.models.ConversionRateUnitConfig +import com.withorb.api.models.CustomExpiration +import com.withorb.api.models.NewAllocationPrice import com.withorb.api.models.NewBillingCycleConfiguration import com.withorb.api.models.NewDimensionalPriceConfiguration +import com.withorb.api.models.NewPercentageDiscount import com.withorb.api.models.NewPlanUnitPrice import com.withorb.api.models.PlanCreateParams import com.withorb.api.models.PlanUpdateParams +import com.withorb.api.models.TransformPriceFilter import com.withorb.api.models.UnitConfig import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -33,48 +37,104 @@ internal class PlanServiceTest { .currency("currency") .name("name") .addPrice( - NewPlanUnitPrice.builder() - .cadence(NewPlanUnitPrice.Cadence.ANNUAL) - .itemId("item_id") - .modelType(NewPlanUnitPrice.ModelType.UNIT) - .name("Annual fee") - .unitConfig(UnitConfig.builder().unitAmount("unit_amount").build()) - .billableMetricId("billable_metric_id") - .billedInAdvance(true) - .billingCycleConfiguration( - NewBillingCycleConfiguration.builder() - .duration(0L) - .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) - .build() - ) - .conversionRate(0.0) - .unitConversionRateConfig( - ConversionRateUnitConfig.builder().unitAmount("unit_amount").build() - ) - .currency("currency") - .dimensionalPriceConfiguration( - NewDimensionalPriceConfiguration.builder() - .addDimensionValue("string") - .dimensionalPriceGroupId("dimensional_price_group_id") - .externalDimensionalPriceGroupId( - "external_dimensional_price_group_id" + PlanCreateParams.Price.builder() + .allocationPrice( + NewAllocationPrice.builder() + .amount("10.00") + .cadence(NewAllocationPrice.Cadence.MONTHLY) + .currency("USD") + .customExpiration( + CustomExpiration.builder() + .duration(0L) + .durationUnit(CustomExpiration.DurationUnit.DAY) + .build() ) + .expiresAtEndOfCadence(true) .build() ) - .externalPriceId("external_price_id") - .fixedPriceQuantity(0.0) - .invoiceGroupingKey("x") - .invoicingCycleConfiguration( - NewBillingCycleConfiguration.builder() - .duration(0L) - .durationUnit(NewBillingCycleConfiguration.DurationUnit.DAY) + .planPhaseOrder(0L) + .price( + NewPlanUnitPrice.builder() + .cadence(NewPlanUnitPrice.Cadence.ANNUAL) + .itemId("item_id") + .modelType(NewPlanUnitPrice.ModelType.UNIT) + .name("Annual fee") + .unitConfig( + UnitConfig.builder().unitAmount("unit_amount").build() + ) + .billableMetricId("billable_metric_id") + .billedInAdvance(true) + .billingCycleConfiguration( + NewBillingCycleConfiguration.builder() + .duration(0L) + .durationUnit( + NewBillingCycleConfiguration.DurationUnit.DAY + ) + .build() + ) + .conversionRate(0.0) + .unitConversionRateConfig( + ConversionRateUnitConfig.builder() + .unitAmount("unit_amount") + .build() + ) + .currency("currency") + .dimensionalPriceConfiguration( + NewDimensionalPriceConfiguration.builder() + .addDimensionValue("string") + .dimensionalPriceGroupId("dimensional_price_group_id") + .externalDimensionalPriceGroupId( + "external_dimensional_price_group_id" + ) + .build() + ) + .externalPriceId("external_price_id") + .fixedPriceQuantity(0.0) + .invoiceGroupingKey("x") + .invoicingCycleConfiguration( + NewBillingCycleConfiguration.builder() + .duration(0L) + .durationUnit( + NewBillingCycleConfiguration.DurationUnit.DAY + ) + .build() + ) + .metadata( + NewPlanUnitPrice.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .referenceId("reference_id") .build() ) - .metadata( - NewPlanUnitPrice.Metadata.builder() - .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .addAdjustment( + PlanCreateParams.Adjustment.builder() + .adjustment( + NewPercentageDiscount.builder() + .adjustmentType( + NewPercentageDiscount.AdjustmentType.PERCENTAGE_DISCOUNT + ) + .percentageDiscount(0.0) + .appliesToAll(NewPercentageDiscount.AppliesToAll.TRUE) + .addAppliesToItemId("item_1") + .addAppliesToItemId("item_2") + .addAppliesToPriceId("price_1") + .addAppliesToPriceId("price_2") + .currency("currency") + .addFilter( + TransformPriceFilter.builder() + .field(TransformPriceFilter.Field.PRICE_ID) + .operator(TransformPriceFilter.Operator.INCLUDES) + .addValue("string") + .build() + ) + .isInvoiceLevel(true) + .priceType(NewPercentageDiscount.PriceType.USAGE) .build() ) + .planPhaseOrder(0L) .build() ) .defaultInvoiceMemo("default_invoice_memo") @@ -85,6 +145,14 @@ internal class PlanServiceTest { .build() ) .netTerms(0L) + .addPlanPhase( + PlanCreateParams.PlanPhase.builder() + .order(0L) + .alignBillingWithPhaseStartDate(true) + .duration(1L) + .durationUnit(PlanCreateParams.PlanPhase.DurationUnit.DAILY) + .build() + ) .status(PlanCreateParams.Status.ACTIVE) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/beta/ExternalPlanIdServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/beta/ExternalPlanIdServiceTest.kt index 62454617..f8208215 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/beta/ExternalPlanIdServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/beta/ExternalPlanIdServiceTest.kt @@ -133,6 +133,7 @@ internal class ExternalPlanIdServiceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build() @@ -247,6 +248,7 @@ internal class ExternalPlanIdServiceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) + .referenceId("reference_id") .build() ) .build()