From 39936484979235feef711bfde8f3e2333df69d7b Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Wed, 6 Nov 2024 19:41:18 +0000 Subject: [PATCH 1/3] chore(internal): version bump (#100) --- .../api/client/okhttp/OrbOkHttpClient.kt | 34 ++++- .../api/client/okhttp/OrbOkHttpClientAsync.kt | 34 ++++- .../com/withorb/api/core/ClientOptions.kt | 32 ++++- .../com/withorb/api/core/http/HttpRequest.kt | 81 +++++++---- .../models/AlertCreateForCustomerParams.kt | 110 ++++++++++----- .../AlertCreateForExternalCustomerParams.kt | 110 ++++++++++----- .../AlertCreateForSubscriptionParams.kt | 110 ++++++++++----- .../withorb/api/models/AlertDisableParams.kt | 110 ++++++++++----- .../withorb/api/models/AlertEnableParams.kt | 110 ++++++++++----- .../com/withorb/api/models/AlertListParams.kt | 108 ++++++++++----- .../withorb/api/models/AlertRetrieveParams.kt | 110 ++++++++++----- .../withorb/api/models/AlertUpdateParams.kt | 110 ++++++++++----- .../withorb/api/models/CouponArchiveParams.kt | 110 ++++++++++----- .../withorb/api/models/CouponCreateParams.kt | 110 ++++++++++----- .../withorb/api/models/CouponFetchParams.kt | 110 ++++++++++----- .../withorb/api/models/CouponListParams.kt | 108 ++++++++++----- .../models/CouponSubscriptionListParams.kt | 110 ++++++++++----- .../api/models/CreditNoteCreateParams.kt | 110 ++++++++++----- .../api/models/CreditNoteFetchParams.kt | 110 ++++++++++----- .../api/models/CreditNoteListParams.kt | 108 ++++++++++----- .../CustomerBalanceTransactionCreateParams.kt | 110 ++++++++++----- .../CustomerBalanceTransactionListParams.kt | 110 ++++++++++----- .../CustomerCostListByExternalIdParams.kt | 110 ++++++++++----- .../api/models/CustomerCostListParams.kt | 110 ++++++++++----- .../api/models/CustomerCreateParams.kt | 110 ++++++++++----- ...editLedgerCreateEntryByExternalIdParams.kt | 110 ++++++++++----- .../CustomerCreditLedgerCreateEntryParams.kt | 110 ++++++++++----- ...tomerCreditLedgerListByExternalIdParams.kt | 110 ++++++++++----- .../models/CustomerCreditLedgerListParams.kt | 110 ++++++++++----- .../CustomerCreditListByExternalIdParams.kt | 110 ++++++++++----- .../api/models/CustomerCreditListParams.kt | 110 ++++++++++----- ...omerCreditTopUpCreateByExternalIdParams.kt | 110 ++++++++++----- .../models/CustomerCreditTopUpCreateParams.kt | 110 ++++++++++----- ...omerCreditTopUpDeleteByExternalIdParams.kt | 110 ++++++++++----- .../models/CustomerCreditTopUpDeleteParams.kt | 110 ++++++++++----- ...stomerCreditTopUpListByExternalIdParams.kt | 110 ++++++++++----- .../models/CustomerCreditTopUpListParams.kt | 110 ++++++++++----- .../api/models/CustomerDeleteParams.kt | 110 ++++++++++----- .../models/CustomerFetchByExternalIdParams.kt | 110 ++++++++++----- .../withorb/api/models/CustomerFetchParams.kt | 110 ++++++++++----- .../withorb/api/models/CustomerListParams.kt | 108 ++++++++++----- .../CustomerUpdateByExternalIdParams.kt | 110 ++++++++++----- .../api/models/CustomerUpdateParams.kt | 110 ++++++++++----- .../api/models/EventBackfillCloseParams.kt | 110 ++++++++++----- .../api/models/EventBackfillCreateParams.kt | 110 ++++++++++----- .../api/models/EventBackfillFetchParams.kt | 110 ++++++++++----- .../api/models/EventBackfillListParams.kt | 108 ++++++++++----- .../api/models/EventBackfillRevertParams.kt | 110 ++++++++++----- .../api/models/EventDeprecateParams.kt | 110 ++++++++++----- .../withorb/api/models/EventIngestParams.kt | 110 ++++++++++----- .../withorb/api/models/EventSearchParams.kt | 110 ++++++++++----- .../withorb/api/models/EventUpdateParams.kt | 110 ++++++++++----- .../api/models/EventVolumeListParams.kt | 108 ++++++++++----- .../withorb/api/models/InvoiceCreateParams.kt | 110 ++++++++++----- .../withorb/api/models/InvoiceFetchParams.kt | 110 ++++++++++----- .../api/models/InvoiceFetchUpcomingParams.kt | 108 ++++++++++----- .../withorb/api/models/InvoiceIssueParams.kt | 110 ++++++++++----- .../api/models/InvoiceLineItemCreateParams.kt | 110 ++++++++++----- .../withorb/api/models/InvoiceListParams.kt | 108 ++++++++++----- .../api/models/InvoiceMarkPaidParams.kt | 110 ++++++++++----- .../withorb/api/models/InvoiceUpdateParams.kt | 110 ++++++++++----- .../api/models/InvoiceVoidInvoiceParams.kt | 110 ++++++++++----- .../withorb/api/models/ItemCreateParams.kt | 110 ++++++++++----- .../com/withorb/api/models/ItemFetchParams.kt | 110 ++++++++++----- .../com/withorb/api/models/ItemListParams.kt | 108 ++++++++++----- .../withorb/api/models/ItemUpdateParams.kt | 110 ++++++++++----- .../withorb/api/models/MetricCreateParams.kt | 110 ++++++++++----- .../withorb/api/models/MetricFetchParams.kt | 110 ++++++++++----- .../withorb/api/models/MetricListParams.kt | 108 ++++++++++----- .../withorb/api/models/MetricUpdateParams.kt | 110 ++++++++++----- .../withorb/api/models/PlanCreateParams.kt | 110 ++++++++++----- .../models/PlanExternalPlanIdFetchParams.kt | 110 ++++++++++----- .../models/PlanExternalPlanIdUpdateParams.kt | 110 ++++++++++----- .../com/withorb/api/models/PlanFetchParams.kt | 110 ++++++++++----- .../com/withorb/api/models/PlanListParams.kt | 108 ++++++++++----- .../withorb/api/models/PlanUpdateParams.kt | 110 ++++++++++----- .../withorb/api/models/PriceCreateParams.kt | 110 ++++++++++----- .../withorb/api/models/PriceEvaluateParams.kt | 110 ++++++++++----- .../models/PriceExternalPriceIdFetchParams.kt | 110 ++++++++++----- .../PriceExternalPriceIdUpdateParams.kt | 110 ++++++++++----- .../withorb/api/models/PriceFetchParams.kt | 110 ++++++++++----- .../com/withorb/api/models/PriceListParams.kt | 108 ++++++++++----- .../withorb/api/models/PriceUpdateParams.kt | 110 ++++++++++----- .../api/models/SubscriptionCancelParams.kt | 110 ++++++++++----- .../api/models/SubscriptionCreateParams.kt | 110 ++++++++++----- .../models/SubscriptionFetchCostsParams.kt | 110 ++++++++++----- .../api/models/SubscriptionFetchParams.kt | 110 ++++++++++----- .../models/SubscriptionFetchScheduleParams.kt | 110 ++++++++++----- .../models/SubscriptionFetchUsageParams.kt | 110 ++++++++++----- .../api/models/SubscriptionListParams.kt | 108 ++++++++++----- .../SubscriptionPriceIntervalsParams.kt | 110 ++++++++++----- .../SubscriptionSchedulePlanChangeParams.kt | 110 ++++++++++----- .../models/SubscriptionTriggerPhaseParams.kt | 110 ++++++++++----- ...ubscriptionUnscheduleCancellationParams.kt | 110 ++++++++++----- ...UnscheduleFixedFeeQuantityUpdatesParams.kt | 110 ++++++++++----- ...ptionUnschedulePendingPlanChangesParams.kt | 110 ++++++++++----- ...ubscriptionUpdateFixedFeeQuantityParams.kt | 110 ++++++++++----- .../api/models/SubscriptionUpdateParams.kt | 110 ++++++++++----- .../models/SubscriptionUpdateTrialParams.kt | 110 ++++++++++----- .../withorb/api/models/TopLevelPingParams.kt | 108 ++++++++++----- .../services/async/AlertServiceAsyncImpl.kt | 64 ++++----- .../services/async/CouponServiceAsyncImpl.kt | 32 ++--- .../async/CreditNoteServiceAsyncImpl.kt | 24 ++-- .../async/CustomerServiceAsyncImpl.kt | 56 ++++---- .../services/async/EventServiceAsyncImpl.kt | 32 ++--- .../async/InvoiceLineItemServiceAsyncImpl.kt | 8 +- .../services/async/InvoiceServiceAsyncImpl.kt | 64 ++++----- .../services/async/ItemServiceAsyncImpl.kt | 32 ++--- .../services/async/MetricServiceAsyncImpl.kt | 32 ++--- .../services/async/PlanServiceAsyncImpl.kt | 32 ++--- .../services/async/PriceServiceAsyncImpl.kt | 40 +++--- .../async/SubscriptionServiceAsyncImpl.kt | 128 +++++++++--------- .../async/TopLevelServiceAsyncImpl.kt | 8 +- .../coupons/SubscriptionServiceAsyncImpl.kt | 8 +- .../BalanceTransactionServiceAsyncImpl.kt | 16 +-- .../async/customers/CostServiceAsyncImpl.kt | 16 +-- .../async/customers/CreditServiceAsyncImpl.kt | 16 +-- .../credits/LedgerServiceAsyncImpl.kt | 32 ++--- .../credits/TopUpServiceAsyncImpl.kt | 48 +++---- .../async/events/BackfillServiceAsyncImpl.kt | 40 +++--- .../async/events/VolumeServiceAsyncImpl.kt | 8 +- .../plans/ExternalPlanIdServiceAsyncImpl.kt | 16 +-- .../prices/ExternalPriceIdServiceAsyncImpl.kt | 16 +-- .../api/services/blocking/AlertServiceImpl.kt | 64 ++++----- .../services/blocking/CouponServiceImpl.kt | 32 ++--- .../blocking/CreditNoteServiceImpl.kt | 24 ++-- .../services/blocking/CustomerServiceImpl.kt | 56 ++++---- .../api/services/blocking/EventServiceImpl.kt | 32 ++--- .../blocking/InvoiceLineItemServiceImpl.kt | 8 +- .../services/blocking/InvoiceServiceImpl.kt | 64 ++++----- .../api/services/blocking/ItemServiceImpl.kt | 32 ++--- .../services/blocking/MetricServiceImpl.kt | 32 ++--- .../api/services/blocking/PlanServiceImpl.kt | 32 ++--- .../api/services/blocking/PriceServiceImpl.kt | 40 +++--- .../blocking/SubscriptionServiceImpl.kt | 128 +++++++++--------- .../services/blocking/TopLevelServiceImpl.kt | 8 +- .../coupons/SubscriptionServiceImpl.kt | 8 +- .../BalanceTransactionServiceImpl.kt | 16 +-- .../blocking/customers/CostServiceImpl.kt | 16 +-- .../blocking/customers/CreditServiceImpl.kt | 16 +-- .../customers/credits/LedgerServiceImpl.kt | 32 ++--- .../customers/credits/TopUpServiceImpl.kt | 48 +++---- .../blocking/events/BackfillServiceImpl.kt | 40 +++--- .../blocking/events/VolumeServiceImpl.kt | 8 +- .../plans/ExternalPlanIdServiceImpl.kt | 16 +-- .../prices/ExternalPriceIdServiceImpl.kt | 16 +-- 146 files changed, 8198 insertions(+), 4051 deletions(-) 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 f7f062efe..50937b67c 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 @@ -50,7 +50,21 @@ class OrbOkHttpClient private constructor() { clientOptions.putAllHeaders(headers) } - fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) } + fun replaceHeaders(name: String, value: String) = apply { + clientOptions.replaceHeaders(name, value) + } + + fun replaceHeaders(name: String, values: Iterable) = apply { + clientOptions.replaceHeaders(name, values) + } + + fun replaceAllHeaders(headers: Map>) = apply { + clientOptions.replaceAllHeaders(headers) + } + + fun removeHeaders(name: String) = apply { clientOptions.removeHeaders(name) } + + fun removeAllHeaders(names: Set) = apply { clientOptions.removeAllHeaders(names) } fun queryParams(queryParams: Map>) = apply { clientOptions.queryParams(queryParams) @@ -68,7 +82,23 @@ class OrbOkHttpClient private constructor() { clientOptions.putAllQueryParams(queryParams) } - fun removeQueryParam(key: String) = apply { clientOptions.removeQueryParam(key) } + fun replaceQueryParams(key: String, value: String) = apply { + clientOptions.replaceQueryParams(key, value) + } + + fun replaceQueryParams(key: String, values: Iterable) = apply { + clientOptions.replaceQueryParams(key, values) + } + + fun replaceAllQueryParams(queryParams: Map>) = apply { + clientOptions.replaceAllQueryParams(queryParams) + } + + fun removeQueryParams(key: String) = apply { clientOptions.removeQueryParams(key) } + + fun removeAllQueryParams(keys: Set) = apply { + clientOptions.removeAllQueryParams(keys) + } fun timeout(timeout: Duration) = apply { this.timeout = timeout } 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 2b3c96197..c489b88db 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 @@ -50,7 +50,21 @@ class OrbOkHttpClientAsync private constructor() { clientOptions.putAllHeaders(headers) } - fun removeHeader(name: String) = apply { clientOptions.removeHeader(name) } + fun replaceHeaders(name: String, value: String) = apply { + clientOptions.replaceHeaders(name, value) + } + + fun replaceHeaders(name: String, values: Iterable) = apply { + clientOptions.replaceHeaders(name, values) + } + + fun replaceAllHeaders(headers: Map>) = apply { + clientOptions.replaceAllHeaders(headers) + } + + fun removeHeaders(name: String) = apply { clientOptions.removeHeaders(name) } + + fun removeAllHeaders(names: Set) = apply { clientOptions.removeAllHeaders(names) } fun queryParams(queryParams: Map>) = apply { clientOptions.queryParams(queryParams) @@ -68,7 +82,23 @@ class OrbOkHttpClientAsync private constructor() { clientOptions.putAllQueryParams(queryParams) } - fun removeQueryParam(key: String) = apply { clientOptions.removeQueryParam(key) } + fun replaceQueryParams(key: String, value: String) = apply { + clientOptions.replaceQueryParams(key, value) + } + + fun replaceQueryParams(key: String, values: Iterable) = apply { + clientOptions.replaceQueryParams(key, values) + } + + fun replaceAllQueryParams(queryParams: Map>) = apply { + clientOptions.replaceAllQueryParams(queryParams) + } + + fun removeQueryParams(key: String) = apply { clientOptions.removeQueryParams(key) } + + fun removeAllQueryParams(keys: Set) = apply { + clientOptions.removeAllQueryParams(keys) + } fun timeout(timeout: Duration) = apply { this.timeout = timeout } 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 e8459db31..f9daec726 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 @@ -94,7 +94,21 @@ private constructor( headers.forEach(this::putHeaders) } - fun removeHeader(name: String) = apply { this.headers.put(name, mutableListOf()) } + fun replaceHeaders(name: String, value: String) = apply { + headers.replaceValues(name, listOf(value)) + } + + fun replaceHeaders(name: String, values: Iterable) = apply { + headers.replaceValues(name, values) + } + + fun replaceAllHeaders(headers: Map>) = apply { + headers.forEach(::replaceHeaders) + } + + fun removeHeaders(name: String) = apply { headers.removeAll(name) } + + fun removeAllHeaders(names: Set) = apply { names.forEach(::removeHeaders) } fun queryParams(queryParams: Map>) = apply { this.queryParams.clear() @@ -111,7 +125,21 @@ private constructor( queryParams.forEach(this::putQueryParams) } - fun removeQueryParam(key: String) = apply { queryParams.removeAll(key) } + fun replaceQueryParams(key: String, value: String) = apply { + queryParams.replaceValues(key, listOf(value)) + } + + fun replaceQueryParams(key: String, values: Iterable) = apply { + queryParams.replaceValues(key, values) + } + + fun replaceAllQueryParams(queryParams: Map>) = apply { + queryParams.forEach(::replaceQueryParams) + } + + fun removeQueryParams(key: String) = apply { queryParams.removeAll(key) } + + fun removeAllQueryParams(keys: Set) = apply { keys.forEach(::removeQueryParams) } fun responseValidation(responseValidation: Boolean) = apply { this.responseValidation = responseValidation 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 b2274d812..5992c4a52 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 @@ -2,7 +2,6 @@ package com.withorb.api.core.http import com.google.common.collect.ArrayListMultimap import com.google.common.collect.ListMultimap -import com.google.common.collect.Multimap import com.google.common.collect.MultimapBuilder import com.withorb.api.core.toImmutable @@ -11,13 +10,13 @@ private constructor( @get:JvmName("method") val method: HttpMethod, @get:JvmName("url") val url: String?, @get:JvmName("pathSegments") val pathSegments: List, - @get:JvmName("queryParams") val queryParams: ListMultimap, @get:JvmName("headers") val headers: ListMultimap, + @get:JvmName("queryParams") val queryParams: ListMultimap, @get:JvmName("body") val body: HttpRequestBody?, ) { override fun toString(): String = - "HttpRequest{method=$method, pathSegments=$pathSegments, queryParams=$queryParams, headers=$headers, body=$body}" + "HttpRequest{method=$method, url=$url, pathSegments=$pathSegments, headers=$headers, queryParams=$queryParams, body=$body}" companion object { @JvmStatic fun builder() = Builder() @@ -27,56 +26,84 @@ private constructor( private var method: HttpMethod? = null private var url: String? = null - private var pathSegments: MutableList = ArrayList() - private var queryParams: ListMultimap = ArrayListMultimap.create() - private var body: HttpRequestBody? = null + private var pathSegments: MutableList = mutableListOf() private var headers: ListMultimap = MultimapBuilder.treeKeys(String.CASE_INSENSITIVE_ORDER).arrayListValues().build() + private var queryParams: ListMultimap = ArrayListMultimap.create() + private var body: HttpRequestBody? = null fun method(method: HttpMethod) = apply { this.method = method } fun url(url: String) = apply { this.url = url } - fun addPathSegment(pathSegment: String) = apply { this.pathSegments.add(pathSegment) } + fun addPathSegment(pathSegment: String) = apply { pathSegments.add(pathSegment) } fun addPathSegments(vararg pathSegments: String) = apply { - for (pathSegment in pathSegments) { - this.pathSegments.add(pathSegment) - } + this.pathSegments.addAll(pathSegments) } - fun putQueryParam(name: String, value: String) = apply { - this.queryParams.replaceValues(name, listOf(value)) + fun headers(headers: Map>) = apply { + this.headers.clear() + putAllHeaders(headers) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.queryParams.replaceValues(name, values) + fun putHeader(name: String, value: String) = apply { headers.put(name, value) } + + fun putHeaders(name: String, values: Iterable) = apply { + headers.putAll(name, values) } - fun putAllQueryParams(queryParams: Map>) = apply { - queryParams.forEach(this::putQueryParams) + fun putAllHeaders(headers: Map>) = apply { + headers.forEach(::putHeaders) } - fun putAllQueryParams(queryParams: Multimap) = apply { - queryParams.asMap().forEach(this::putQueryParams) + fun replaceHeaders(name: String, value: String) = apply { + headers.replaceValues(name, listOf(value)) } - fun putHeader(name: String, value: String) = apply { - this.headers.replaceValues(name, listOf(value)) + fun replaceHeaders(name: String, values: Iterable) = apply { + headers.replaceValues(name, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.headers.replaceValues(name, values) + fun replaceAllHeaders(headers: Map>) = apply { + headers.forEach(::replaceHeaders) } - fun putAllHeaders(headers: Map>) = apply { - headers.forEach(this::putHeaders) + fun removeHeaders(name: String) = apply { headers.removeAll(name) } + + fun removeAllHeaders(names: Set) = apply { names.forEach(::removeHeaders) } + + fun queryParams(queryParams: Map>) = apply { + this.queryParams.clear() + putAllQueryParams(queryParams) } - fun putAllHeaders(headers: Multimap) = apply { - headers.asMap().forEach(this::putHeaders) + fun putQueryParam(key: String, value: String) = apply { queryParams.put(key, value) } + + fun putQueryParams(key: String, values: Iterable) = apply { + queryParams.putAll(key, values) + } + + fun putAllQueryParams(queryParams: Map>) = apply { + queryParams.forEach(::putQueryParams) + } + + fun replaceQueryParams(key: String, value: String) = apply { + queryParams.replaceValues(key, listOf(value)) + } + + fun replaceQueryParams(key: String, values: Iterable) = apply { + queryParams.replaceValues(key, values) + } + + fun replaceAllQueryParams(queryParams: Map>) = apply { + queryParams.forEach(::replaceQueryParams) } + fun removeQueryParams(key: String) = apply { queryParams.removeAll(key) } + + fun removeAllQueryParams(keys: Set) = apply { keys.forEach(::removeQueryParams) } + fun body(body: HttpRequestBody) = apply { this.body = body } fun build(): HttpRequest = @@ -84,8 +111,8 @@ private constructor( checkNotNull(method) { "`method` is required but was not set" }, url, pathSegments.toImmutable(), - queryParams.toImmutable(), headers, + queryParams.toImmutable(), body, ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt index bad3201d4..b93399d61 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField @@ -24,8 +26,8 @@ constructor( private val currency: String, private val type: Type, private val thresholds: List?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -47,10 +49,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -158,10 +160,10 @@ constructor( "AlertCreateForCustomerBody{currency=$currency, type=$type, thresholds=$thresholds, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -169,15 +171,15 @@ constructor( return true } - return /* spotless:off */ other is AlertCreateForCustomerParams && this.customerId == other.customerId && this.currency == other.currency && this.type == other.type && this.thresholds == other.thresholds && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is AlertCreateForCustomerParams && this.customerId == other.customerId && this.currency == other.currency && this.type == other.type && this.thresholds == other.thresholds && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, currency, type, thresholds, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, currency, type, thresholds, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "AlertCreateForCustomerParams{customerId=$customerId, currency=$currency, type=$type, thresholds=$thresholds, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "AlertCreateForCustomerParams{customerId=$customerId, currency=$currency, type=$type, thresholds=$thresholds, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -193,8 +195,8 @@ constructor( private var currency: String? = null private var type: Type? = null private var thresholds: MutableList = mutableListOf() - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -203,8 +205,8 @@ constructor( this.currency = alertCreateForCustomerParams.currency this.type = alertCreateForCustomerParams.type this.thresholds(alertCreateForCustomerParams.thresholds ?: listOf()) - additionalQueryParams(alertCreateForCustomerParams.additionalQueryParams) additionalHeaders(alertCreateForCustomerParams.additionalHeaders) + additionalQueryParams(alertCreateForCustomerParams.additionalQueryParams) additionalBodyProperties(alertCreateForCustomerParams.additionalBodyProperties) } @@ -225,45 +227,79 @@ constructor( /** The thresholds that define the values at which the alert will be triggered. */ fun addThreshold(threshold: Threshold) = apply { this.thresholds.add(threshold) } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -285,8 +321,14 @@ constructor( checkNotNull(currency) { "`currency` is required but was not set" }, checkNotNull(type) { "`type` is required but was not set" }, if (thresholds.size == 0) null else thresholds.toImmutable(), - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt index 59b5c3efd..fe87013b0 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField @@ -24,8 +26,8 @@ constructor( private val currency: String, private val type: Type, private val thresholds: List?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -47,10 +49,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> externalCustomerId @@ -160,10 +162,10 @@ constructor( "AlertCreateForExternalCustomerBody{currency=$currency, type=$type, thresholds=$thresholds, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -171,15 +173,15 @@ constructor( return true } - return /* spotless:off */ other is AlertCreateForExternalCustomerParams && this.externalCustomerId == other.externalCustomerId && this.currency == other.currency && this.type == other.type && this.thresholds == other.thresholds && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is AlertCreateForExternalCustomerParams && this.externalCustomerId == other.externalCustomerId && this.currency == other.currency && this.type == other.type && this.thresholds == other.thresholds && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(externalCustomerId, currency, type, thresholds, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(externalCustomerId, currency, type, thresholds, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "AlertCreateForExternalCustomerParams{externalCustomerId=$externalCustomerId, currency=$currency, type=$type, thresholds=$thresholds, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "AlertCreateForExternalCustomerParams{externalCustomerId=$externalCustomerId, currency=$currency, type=$type, thresholds=$thresholds, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -195,8 +197,8 @@ constructor( private var currency: String? = null private var type: Type? = null private var thresholds: MutableList = mutableListOf() - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -207,8 +209,8 @@ constructor( this.currency = alertCreateForExternalCustomerParams.currency this.type = alertCreateForExternalCustomerParams.type this.thresholds(alertCreateForExternalCustomerParams.thresholds ?: listOf()) - additionalQueryParams(alertCreateForExternalCustomerParams.additionalQueryParams) additionalHeaders(alertCreateForExternalCustomerParams.additionalHeaders) + additionalQueryParams(alertCreateForExternalCustomerParams.additionalQueryParams) additionalBodyProperties(alertCreateForExternalCustomerParams.additionalBodyProperties) } @@ -231,45 +233,79 @@ constructor( /** The thresholds that define the values at which the alert will be triggered. */ fun addThreshold(threshold: Threshold) = apply { this.thresholds.add(threshold) } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -293,8 +329,14 @@ constructor( checkNotNull(currency) { "`currency` is required but was not set" }, checkNotNull(type) { "`type` is required but was not set" }, if (thresholds.size == 0) null else thresholds.toImmutable(), - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt index 047e0e127..588edcd17 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField @@ -24,8 +26,8 @@ constructor( private val thresholds: List, private val type: Type, private val metricId: String?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -47,10 +49,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -160,10 +162,10 @@ constructor( "AlertCreateForSubscriptionBody{thresholds=$thresholds, type=$type, metricId=$metricId, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -171,15 +173,15 @@ constructor( return true } - return /* spotless:off */ other is AlertCreateForSubscriptionParams && this.subscriptionId == other.subscriptionId && this.thresholds == other.thresholds && this.type == other.type && this.metricId == other.metricId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is AlertCreateForSubscriptionParams && this.subscriptionId == other.subscriptionId && this.thresholds == other.thresholds && this.type == other.type && this.metricId == other.metricId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, thresholds, type, metricId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, thresholds, type, metricId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "AlertCreateForSubscriptionParams{subscriptionId=$subscriptionId, thresholds=$thresholds, type=$type, metricId=$metricId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "AlertCreateForSubscriptionParams{subscriptionId=$subscriptionId, thresholds=$thresholds, type=$type, metricId=$metricId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -195,8 +197,8 @@ constructor( private var thresholds: MutableList = mutableListOf() private var type: Type? = null private var metricId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -206,8 +208,8 @@ constructor( this.thresholds(alertCreateForSubscriptionParams.thresholds) this.type = alertCreateForSubscriptionParams.type this.metricId = alertCreateForSubscriptionParams.metricId - additionalQueryParams(alertCreateForSubscriptionParams.additionalQueryParams) additionalHeaders(alertCreateForSubscriptionParams.additionalHeaders) + additionalQueryParams(alertCreateForSubscriptionParams.additionalQueryParams) additionalBodyProperties(alertCreateForSubscriptionParams.additionalBodyProperties) } @@ -228,45 +230,79 @@ constructor( /** The metric to track usage for. */ fun metricId(metricId: String) = apply { this.metricId = metricId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -289,8 +325,14 @@ constructor( .toImmutable(), checkNotNull(type) { "`type` is required but was not set" }, metricId, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt index bbce3b0d1..058b554ce 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable @@ -12,8 +14,8 @@ import java.util.Optional class AlertDisableParams constructor( private val alertConfigurationId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -24,10 +26,10 @@ constructor( return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> alertConfigurationId @@ -35,10 +37,10 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -46,15 +48,15 @@ constructor( return true } - return /* spotless:off */ other is AlertDisableParams && this.alertConfigurationId == other.alertConfigurationId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is AlertDisableParams && this.alertConfigurationId == other.alertConfigurationId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(alertConfigurationId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(alertConfigurationId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "AlertDisableParams{alertConfigurationId=$alertConfigurationId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "AlertDisableParams{alertConfigurationId=$alertConfigurationId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -67,15 +69,15 @@ constructor( class Builder { private var alertConfigurationId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(alertDisableParams: AlertDisableParams) = apply { this.alertConfigurationId = alertDisableParams.alertConfigurationId - additionalQueryParams(alertDisableParams.additionalQueryParams) additionalHeaders(alertDisableParams.additionalHeaders) + additionalQueryParams(alertDisableParams.additionalQueryParams) additionalBodyProperties(alertDisableParams.additionalBodyProperties) } @@ -83,45 +85,79 @@ constructor( this.alertConfigurationId = alertConfigurationId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -142,8 +178,14 @@ constructor( checkNotNull(alertConfigurationId) { "`alertConfigurationId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt index 4e56d0396..5a95dec02 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable @@ -12,8 +14,8 @@ import java.util.Optional class AlertEnableParams constructor( private val alertConfigurationId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -24,10 +26,10 @@ constructor( return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> alertConfigurationId @@ -35,10 +37,10 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -46,15 +48,15 @@ constructor( return true } - return /* spotless:off */ other is AlertEnableParams && this.alertConfigurationId == other.alertConfigurationId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is AlertEnableParams && this.alertConfigurationId == other.alertConfigurationId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(alertConfigurationId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(alertConfigurationId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "AlertEnableParams{alertConfigurationId=$alertConfigurationId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "AlertEnableParams{alertConfigurationId=$alertConfigurationId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -67,15 +69,15 @@ constructor( class Builder { private var alertConfigurationId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(alertEnableParams: AlertEnableParams) = apply { this.alertConfigurationId = alertEnableParams.alertConfigurationId - additionalQueryParams(alertEnableParams.additionalQueryParams) additionalHeaders(alertEnableParams.additionalHeaders) + additionalQueryParams(alertEnableParams.additionalQueryParams) additionalBodyProperties(alertEnableParams.additionalBodyProperties) } @@ -83,45 +85,79 @@ constructor( this.alertConfigurationId = alertConfigurationId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -142,8 +178,14 @@ constructor( checkNotNull(alertConfigurationId) { "`alertConfigurationId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt index 402fd26a5..e3c683042 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -21,8 +23,8 @@ constructor( private val externalCustomerId: String?, private val limit: Long?, private val subscriptionId: String?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun createdAtGt(): Optional = Optional.ofNullable(createdAtGt) @@ -43,6 +45,8 @@ constructor( fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -67,26 +71,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is AlertListParams && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.cursor == other.cursor && this.customerId == other.customerId && this.externalCustomerId == other.externalCustomerId && this.limit == other.limit && this.subscriptionId == other.subscriptionId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is AlertListParams && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.cursor == other.cursor && this.customerId == other.customerId && this.externalCustomerId == other.externalCustomerId && this.limit == other.limit && this.subscriptionId == other.subscriptionId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(createdAtGt, createdAtGte, createdAtLt, createdAtLte, cursor, customerId, externalCustomerId, limit, subscriptionId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(createdAtGt, createdAtGte, createdAtLt, createdAtLte, cursor, customerId, externalCustomerId, limit, subscriptionId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "AlertListParams{createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, cursor=$cursor, customerId=$customerId, externalCustomerId=$externalCustomerId, limit=$limit, subscriptionId=$subscriptionId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "AlertListParams{createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, cursor=$cursor, customerId=$customerId, externalCustomerId=$externalCustomerId, limit=$limit, subscriptionId=$subscriptionId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -107,8 +109,8 @@ constructor( private var externalCustomerId: String? = null private var limit: Long? = null private var subscriptionId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(alertListParams: AlertListParams) = apply { @@ -121,8 +123,8 @@ constructor( this.externalCustomerId = alertListParams.externalCustomerId this.limit = alertListParams.limit this.subscriptionId = alertListParams.subscriptionId - additionalQueryParams(alertListParams.additionalQueryParams) additionalHeaders(alertListParams.additionalHeaders) + additionalQueryParams(alertListParams.additionalQueryParams) } fun createdAtGt(createdAtGt: OffsetDateTime) = apply { this.createdAtGt = createdAtGt } @@ -153,45 +155,79 @@ constructor( /** Fetch alerts scoped to this subscription_id */ fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): AlertListParams = AlertListParams( @@ -204,8 +240,14 @@ constructor( externalCustomerId, limit, subscriptionId, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertRetrieveParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertRetrieveParams.kt index fc9be5f33..96cf6e1c0 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertRetrieveParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertRetrieveParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class AlertRetrieveParams constructor( private val alertId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun alertId(): String = alertId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> alertId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is AlertRetrieveParams && this.alertId == other.alertId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is AlertRetrieveParams && this.alertId == other.alertId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(alertId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(alertId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "AlertRetrieveParams{alertId=$alertId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "AlertRetrieveParams{alertId=$alertId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,63 +59,103 @@ constructor( class Builder { private var alertId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(alertRetrieveParams: AlertRetrieveParams) = apply { this.alertId = alertRetrieveParams.alertId - additionalQueryParams(alertRetrieveParams.additionalQueryParams) additionalHeaders(alertRetrieveParams.additionalHeaders) + additionalQueryParams(alertRetrieveParams.additionalQueryParams) } fun alertId(alertId: String) = apply { this.alertId = alertId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): AlertRetrieveParams = AlertRetrieveParams( checkNotNull(alertId) { "`alertId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt index 1f79eee76..c32ead193 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -17,8 +19,8 @@ class AlertUpdateParams constructor( private val alertConfigurationId: String, private val thresholds: List, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -31,10 +33,10 @@ constructor( return AlertUpdateBody(thresholds, additionalBodyProperties) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> alertConfigurationId @@ -122,10 +124,10 @@ constructor( "AlertUpdateBody{thresholds=$thresholds, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -133,15 +135,15 @@ constructor( return true } - return /* spotless:off */ other is AlertUpdateParams && this.alertConfigurationId == other.alertConfigurationId && this.thresholds == other.thresholds && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is AlertUpdateParams && this.alertConfigurationId == other.alertConfigurationId && this.thresholds == other.thresholds && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(alertConfigurationId, thresholds, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(alertConfigurationId, thresholds, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "AlertUpdateParams{alertConfigurationId=$alertConfigurationId, thresholds=$thresholds, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "AlertUpdateParams{alertConfigurationId=$alertConfigurationId, thresholds=$thresholds, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -155,16 +157,16 @@ constructor( private var alertConfigurationId: String? = null private var thresholds: MutableList = mutableListOf() - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(alertUpdateParams: AlertUpdateParams) = apply { this.alertConfigurationId = alertUpdateParams.alertConfigurationId this.thresholds(alertUpdateParams.thresholds) - additionalQueryParams(alertUpdateParams.additionalQueryParams) additionalHeaders(alertUpdateParams.additionalHeaders) + additionalQueryParams(alertUpdateParams.additionalQueryParams) additionalBodyProperties(alertUpdateParams.additionalBodyProperties) } @@ -181,45 +183,79 @@ constructor( /** The thresholds that define the values at which the alert will be triggered. */ fun addThreshold(threshold: Threshold) = apply { this.thresholds.add(threshold) } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -242,8 +278,14 @@ constructor( }, checkNotNull(thresholds) { "`thresholds` is required but was not set" } .toImmutable(), - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt index 77f537951..1fb52c44f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable @@ -12,8 +14,8 @@ import java.util.Optional class CouponArchiveParams constructor( private val couponId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -24,10 +26,10 @@ constructor( return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> couponId @@ -35,10 +37,10 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -46,15 +48,15 @@ constructor( return true } - return /* spotless:off */ other is CouponArchiveParams && this.couponId == other.couponId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CouponArchiveParams && this.couponId == other.couponId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(couponId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(couponId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CouponArchiveParams{couponId=$couponId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CouponArchiveParams{couponId=$couponId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -67,59 +69,93 @@ constructor( class Builder { private var couponId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(couponArchiveParams: CouponArchiveParams) = apply { this.couponId = couponArchiveParams.couponId - additionalQueryParams(couponArchiveParams.additionalQueryParams) additionalHeaders(couponArchiveParams.additionalHeaders) + additionalQueryParams(couponArchiveParams.additionalQueryParams) additionalBodyProperties(couponArchiveParams.additionalBodyProperties) } fun couponId(couponId: String) = apply { this.couponId = couponId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -138,8 +174,14 @@ constructor( fun build(): CouponArchiveParams = CouponArchiveParams( checkNotNull(couponId) { "`couponId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt index a2989f915..efb1e3226 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer import com.withorb.api.core.Enum @@ -35,8 +37,8 @@ constructor( private val redemptionCode: String, private val durationInMonths: Long?, private val maxRedemptions: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -59,10 +61,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = CouponCreateBody.Builder::class) @NoAutoDetect class CouponCreateBody @@ -191,10 +193,10 @@ constructor( "CouponCreateBody{discount=$discount, redemptionCode=$redemptionCode, durationInMonths=$durationInMonths, maxRedemptions=$maxRedemptions, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -202,15 +204,15 @@ constructor( return true } - return /* spotless:off */ other is CouponCreateParams && this.discount == other.discount && this.redemptionCode == other.redemptionCode && this.durationInMonths == other.durationInMonths && this.maxRedemptions == other.maxRedemptions && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CouponCreateParams && this.discount == other.discount && this.redemptionCode == other.redemptionCode && this.durationInMonths == other.durationInMonths && this.maxRedemptions == other.maxRedemptions && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(discount, redemptionCode, durationInMonths, maxRedemptions, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(discount, redemptionCode, durationInMonths, maxRedemptions, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CouponCreateParams{discount=$discount, redemptionCode=$redemptionCode, durationInMonths=$durationInMonths, maxRedemptions=$maxRedemptions, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CouponCreateParams{discount=$discount, redemptionCode=$redemptionCode, durationInMonths=$durationInMonths, maxRedemptions=$maxRedemptions, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -226,8 +228,8 @@ constructor( private var redemptionCode: String? = null private var durationInMonths: Long? = null private var maxRedemptions: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -236,8 +238,8 @@ constructor( this.redemptionCode = couponCreateParams.redemptionCode this.durationInMonths = couponCreateParams.durationInMonths this.maxRedemptions = couponCreateParams.maxRedemptions - additionalQueryParams(couponCreateParams.additionalQueryParams) additionalHeaders(couponCreateParams.additionalHeaders) + additionalQueryParams(couponCreateParams.additionalQueryParams) additionalBodyProperties(couponCreateParams.additionalBodyProperties) } @@ -268,45 +270,79 @@ constructor( */ fun maxRedemptions(maxRedemptions: Long) = apply { this.maxRedemptions = maxRedemptions } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -328,8 +364,14 @@ constructor( checkNotNull(redemptionCode) { "`redemptionCode` is required but was not set" }, durationInMonths, maxRedemptions, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponFetchParams.kt index ddaea0984..8a91ffd44 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponFetchParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class CouponFetchParams constructor( private val couponId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun couponId(): String = couponId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> couponId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CouponFetchParams && this.couponId == other.couponId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CouponFetchParams && this.couponId == other.couponId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(couponId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(couponId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CouponFetchParams{couponId=$couponId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CouponFetchParams{couponId=$couponId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,63 +59,103 @@ constructor( class Builder { private var couponId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(couponFetchParams: CouponFetchParams) = apply { this.couponId = couponFetchParams.couponId - additionalQueryParams(couponFetchParams.additionalQueryParams) additionalHeaders(couponFetchParams.additionalHeaders) + additionalQueryParams(couponFetchParams.additionalQueryParams) } fun couponId(couponId: String) = apply { this.couponId = couponId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CouponFetchParams = CouponFetchParams( checkNotNull(couponId) { "`couponId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListParams.kt index e19034e50..0a3fd79af 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -14,8 +16,8 @@ constructor( private val limit: Long?, private val redemptionCode: String?, private val showArchived: Boolean?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun cursor(): Optional = Optional.ofNullable(cursor) @@ -26,6 +28,8 @@ constructor( fun showArchived(): Optional = Optional.ofNullable(showArchived) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -37,26 +41,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CouponListParams && this.cursor == other.cursor && this.limit == other.limit && this.redemptionCode == other.redemptionCode && this.showArchived == other.showArchived && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CouponListParams && this.cursor == other.cursor && this.limit == other.limit && this.redemptionCode == other.redemptionCode && this.showArchived == other.showArchived && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(cursor, limit, redemptionCode, showArchived, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(cursor, limit, redemptionCode, showArchived, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CouponListParams{cursor=$cursor, limit=$limit, redemptionCode=$redemptionCode, showArchived=$showArchived, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CouponListParams{cursor=$cursor, limit=$limit, redemptionCode=$redemptionCode, showArchived=$showArchived, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -72,8 +74,8 @@ constructor( private var limit: Long? = null private var redemptionCode: String? = null private var showArchived: Boolean? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(couponListParams: CouponListParams) = apply { @@ -81,8 +83,8 @@ constructor( this.limit = couponListParams.limit this.redemptionCode = couponListParams.redemptionCode this.showArchived = couponListParams.showArchived - additionalQueryParams(couponListParams.additionalQueryParams) additionalHeaders(couponListParams.additionalHeaders) + additionalQueryParams(couponListParams.additionalQueryParams) } /** @@ -102,45 +104,79 @@ constructor( */ fun showArchived(showArchived: Boolean) = apply { this.showArchived = showArchived } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CouponListParams = CouponListParams( @@ -148,8 +184,14 @@ constructor( limit, redemptionCode, showArchived, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListParams.kt index 042385807..67c93ed08 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -13,8 +15,8 @@ constructor( private val couponId: String, private val cursor: String?, private val limit: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun couponId(): String = couponId @@ -23,6 +25,8 @@ constructor( fun limit(): Optional = Optional.ofNullable(limit) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -32,8 +36,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> couponId @@ -41,24 +43,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CouponSubscriptionListParams && this.couponId == other.couponId && this.cursor == other.cursor && this.limit == other.limit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CouponSubscriptionListParams && this.couponId == other.couponId && this.cursor == other.cursor && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(couponId, cursor, limit, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(couponId, cursor, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CouponSubscriptionListParams{couponId=$couponId, cursor=$cursor, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CouponSubscriptionListParams{couponId=$couponId, cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -73,16 +75,16 @@ constructor( private var couponId: String? = null private var cursor: String? = null private var limit: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(couponSubscriptionListParams: CouponSubscriptionListParams) = apply { this.couponId = couponSubscriptionListParams.couponId this.cursor = couponSubscriptionListParams.cursor this.limit = couponSubscriptionListParams.limit - additionalQueryParams(couponSubscriptionListParams.additionalQueryParams) additionalHeaders(couponSubscriptionListParams.additionalHeaders) + additionalQueryParams(couponSubscriptionListParams.additionalQueryParams) } fun couponId(couponId: String) = apply { this.couponId = couponId } @@ -96,53 +98,93 @@ constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long) = apply { this.limit = limit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CouponSubscriptionListParams = CouponSubscriptionListParams( checkNotNull(couponId) { "`couponId` is required but was not set" }, cursor, limit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt index f2b847dfe..6f6db274b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField @@ -23,8 +25,8 @@ constructor( private val lineItems: List, private val memo: String?, private val reason: Reason?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -44,10 +46,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = CreditNoteCreateBody.Builder::class) @NoAutoDetect class CreditNoteCreateBody @@ -146,10 +148,10 @@ constructor( "CreditNoteCreateBody{lineItems=$lineItems, memo=$memo, reason=$reason, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -157,15 +159,15 @@ constructor( return true } - return /* spotless:off */ other is CreditNoteCreateParams && this.lineItems == other.lineItems && this.memo == other.memo && this.reason == other.reason && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CreditNoteCreateParams && this.lineItems == other.lineItems && this.memo == other.memo && this.reason == other.reason && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(lineItems, memo, reason, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(lineItems, memo, reason, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CreditNoteCreateParams{lineItems=$lineItems, memo=$memo, reason=$reason, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CreditNoteCreateParams{lineItems=$lineItems, memo=$memo, reason=$reason, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -180,8 +182,8 @@ constructor( private var lineItems: MutableList = mutableListOf() private var memo: String? = null private var reason: Reason? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -189,8 +191,8 @@ constructor( this.lineItems(creditNoteCreateParams.lineItems) this.memo = creditNoteCreateParams.memo this.reason = creditNoteCreateParams.reason - additionalQueryParams(creditNoteCreateParams.additionalQueryParams) additionalHeaders(creditNoteCreateParams.additionalHeaders) + additionalQueryParams(creditNoteCreateParams.additionalQueryParams) additionalBodyProperties(creditNoteCreateParams.additionalBodyProperties) } @@ -207,45 +209,79 @@ constructor( /** An optional reason for the credit note. */ fun reason(reason: Reason) = apply { this.reason = reason } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -266,8 +302,14 @@ constructor( checkNotNull(lineItems) { "`lineItems` is required but was not set" }.toImmutable(), memo, reason, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteFetchParams.kt index c36dcc548..d966df4cd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteFetchParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class CreditNoteFetchParams constructor( private val creditNoteId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun creditNoteId(): String = creditNoteId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> creditNoteId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CreditNoteFetchParams && this.creditNoteId == other.creditNoteId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CreditNoteFetchParams && this.creditNoteId == other.creditNoteId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(creditNoteId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(creditNoteId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CreditNoteFetchParams{creditNoteId=$creditNoteId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CreditNoteFetchParams{creditNoteId=$creditNoteId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,63 +59,103 @@ constructor( class Builder { private var creditNoteId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(creditNoteFetchParams: CreditNoteFetchParams) = apply { this.creditNoteId = creditNoteFetchParams.creditNoteId - additionalQueryParams(creditNoteFetchParams.additionalQueryParams) additionalHeaders(creditNoteFetchParams.additionalHeaders) + additionalQueryParams(creditNoteFetchParams.additionalQueryParams) } fun creditNoteId(creditNoteId: String) = apply { this.creditNoteId = creditNoteId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CreditNoteFetchParams = CreditNoteFetchParams( checkNotNull(creditNoteId) { "`creditNoteId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListParams.kt index c55641f93..578a6926a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -12,14 +14,16 @@ class CreditNoteListParams constructor( private val cursor: String?, private val limit: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun cursor(): Optional = Optional.ofNullable(cursor) fun limit(): Optional = Optional.ofNullable(limit) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -29,26 +33,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CreditNoteListParams && this.cursor == other.cursor && this.limit == other.limit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CreditNoteListParams && this.cursor == other.cursor && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(cursor, limit, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(cursor, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CreditNoteListParams{cursor=$cursor, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CreditNoteListParams{cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -62,15 +64,15 @@ constructor( private var cursor: String? = null private var limit: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(creditNoteListParams: CreditNoteListParams) = apply { this.cursor = creditNoteListParams.cursor this.limit = creditNoteListParams.limit - additionalQueryParams(creditNoteListParams.additionalQueryParams) additionalHeaders(creditNoteListParams.additionalHeaders) + additionalQueryParams(creditNoteListParams.additionalQueryParams) } /** @@ -82,52 +84,92 @@ constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long) = apply { this.limit = limit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CreditNoteListParams = CreditNoteListParams( cursor, limit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt index 907f01313..ec8fa2c70 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField @@ -24,8 +26,8 @@ constructor( private val amount: String, private val type: Type, private val description: String?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -47,10 +49,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -155,10 +157,10 @@ constructor( "CustomerBalanceTransactionCreateBody{amount=$amount, type=$type, description=$description, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -166,15 +168,15 @@ constructor( return true } - return /* spotless:off */ other is CustomerBalanceTransactionCreateParams && this.customerId == other.customerId && this.amount == other.amount && this.type == other.type && this.description == other.description && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerBalanceTransactionCreateParams && this.customerId == other.customerId && this.amount == other.amount && this.type == other.type && this.description == other.description && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, amount, type, description, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, amount, type, description, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CustomerBalanceTransactionCreateParams{customerId=$customerId, amount=$amount, type=$type, description=$description, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CustomerBalanceTransactionCreateParams{customerId=$customerId, amount=$amount, type=$type, description=$description, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -190,8 +192,8 @@ constructor( private var amount: String? = null private var type: Type? = null private var description: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -202,8 +204,8 @@ constructor( this.amount = customerBalanceTransactionCreateParams.amount this.type = customerBalanceTransactionCreateParams.type this.description = customerBalanceTransactionCreateParams.description - additionalQueryParams(customerBalanceTransactionCreateParams.additionalQueryParams) additionalHeaders(customerBalanceTransactionCreateParams.additionalHeaders) + additionalQueryParams(customerBalanceTransactionCreateParams.additionalQueryParams) additionalBodyProperties( customerBalanceTransactionCreateParams.additionalBodyProperties ) @@ -218,45 +220,79 @@ constructor( /** An optional description that can be specified around this entry. */ fun description(description: String) = apply { this.description = description } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -278,8 +314,14 @@ constructor( checkNotNull(amount) { "`amount` is required but was not set" }, checkNotNull(type) { "`type` is required but was not set" }, description, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt index 929b42e4c..01c9d5d4e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -19,8 +21,8 @@ constructor( private val operationTimeGte: OffsetDateTime?, private val operationTimeLt: OffsetDateTime?, private val operationTimeLte: OffsetDateTime?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun customerId(): String = customerId @@ -37,6 +39,8 @@ constructor( fun operationTimeLte(): Optional = Optional.ofNullable(operationTimeLte) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -70,8 +74,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -79,24 +81,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerBalanceTransactionListParams && this.customerId == other.customerId && this.cursor == other.cursor && this.limit == other.limit && this.operationTimeGt == other.operationTimeGt && this.operationTimeGte == other.operationTimeGte && this.operationTimeLt == other.operationTimeLt && this.operationTimeLte == other.operationTimeLte && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerBalanceTransactionListParams && this.customerId == other.customerId && this.cursor == other.cursor && this.limit == other.limit && this.operationTimeGt == other.operationTimeGt && this.operationTimeGte == other.operationTimeGte && this.operationTimeLt == other.operationTimeLt && this.operationTimeLte == other.operationTimeLte && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, cursor, limit, operationTimeGt, operationTimeGte, operationTimeLt, operationTimeLte, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, cursor, limit, operationTimeGt, operationTimeGte, operationTimeLt, operationTimeLte, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerBalanceTransactionListParams{customerId=$customerId, cursor=$cursor, limit=$limit, operationTimeGt=$operationTimeGt, operationTimeGte=$operationTimeGte, operationTimeLt=$operationTimeLt, operationTimeLte=$operationTimeLte, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerBalanceTransactionListParams{customerId=$customerId, cursor=$cursor, limit=$limit, operationTimeGt=$operationTimeGt, operationTimeGte=$operationTimeGte, operationTimeLt=$operationTimeLt, operationTimeLte=$operationTimeLte, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -115,8 +117,8 @@ constructor( private var operationTimeGte: OffsetDateTime? = null private var operationTimeLt: OffsetDateTime? = null private var operationTimeLte: OffsetDateTime? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from( @@ -129,8 +131,8 @@ constructor( this.operationTimeGte = customerBalanceTransactionListParams.operationTimeGte this.operationTimeLt = customerBalanceTransactionListParams.operationTimeLt this.operationTimeLte = customerBalanceTransactionListParams.operationTimeLte - additionalQueryParams(customerBalanceTransactionListParams.additionalQueryParams) additionalHeaders(customerBalanceTransactionListParams.additionalHeaders) + additionalQueryParams(customerBalanceTransactionListParams.additionalQueryParams) } fun customerId(customerId: String) = apply { this.customerId = customerId } @@ -160,45 +162,79 @@ constructor( this.operationTimeLte = operationTimeLte } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerBalanceTransactionListParams = CustomerBalanceTransactionListParams( @@ -209,8 +245,14 @@ constructor( operationTimeGte, operationTimeLt, operationTimeLte, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt index f0c33d349..9caf810ee 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt @@ -3,6 +3,8 @@ package com.withorb.api.models import com.fasterxml.jackson.annotation.JsonCreator +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.JsonValue @@ -22,8 +24,8 @@ constructor( private val timeframeEnd: OffsetDateTime?, private val timeframeStart: OffsetDateTime?, private val viewMode: ViewMode?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun externalCustomerId(): String = externalCustomerId @@ -36,6 +38,8 @@ constructor( fun viewMode(): Optional = Optional.ofNullable(viewMode) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -51,8 +55,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> externalCustomerId @@ -60,24 +62,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCostListByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.currency == other.currency && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.viewMode == other.viewMode && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerCostListByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.currency == other.currency && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.viewMode == other.viewMode && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(externalCustomerId, currency, timeframeEnd, timeframeStart, viewMode, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(externalCustomerId, currency, timeframeEnd, timeframeStart, viewMode, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerCostListByExternalIdParams{externalCustomerId=$externalCustomerId, currency=$currency, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, viewMode=$viewMode, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerCostListByExternalIdParams{externalCustomerId=$externalCustomerId, currency=$currency, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, viewMode=$viewMode, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -94,8 +96,8 @@ constructor( private var timeframeEnd: OffsetDateTime? = null private var timeframeStart: OffsetDateTime? = null private var viewMode: ViewMode? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(customerCostListByExternalIdParams: CustomerCostListByExternalIdParams) = @@ -105,8 +107,8 @@ constructor( this.timeframeEnd = customerCostListByExternalIdParams.timeframeEnd this.timeframeStart = customerCostListByExternalIdParams.timeframeStart this.viewMode = customerCostListByExternalIdParams.viewMode - additionalQueryParams(customerCostListByExternalIdParams.additionalQueryParams) additionalHeaders(customerCostListByExternalIdParams.additionalHeaders) + additionalQueryParams(customerCostListByExternalIdParams.additionalQueryParams) } fun externalCustomerId(externalCustomerId: String) = apply { @@ -131,45 +133,79 @@ constructor( */ fun viewMode(viewMode: ViewMode) = apply { this.viewMode = viewMode } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerCostListByExternalIdParams = CustomerCostListByExternalIdParams( @@ -180,8 +216,14 @@ constructor( timeframeEnd, timeframeStart, viewMode, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt index 7525c1d64..b154da113 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt @@ -3,6 +3,8 @@ package com.withorb.api.models import com.fasterxml.jackson.annotation.JsonCreator +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.JsonValue @@ -22,8 +24,8 @@ constructor( private val timeframeEnd: OffsetDateTime?, private val timeframeStart: OffsetDateTime?, private val viewMode: ViewMode?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun customerId(): String = customerId @@ -36,6 +38,8 @@ constructor( fun viewMode(): Optional = Optional.ofNullable(viewMode) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -51,8 +55,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -60,24 +62,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCostListParams && this.customerId == other.customerId && this.currency == other.currency && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.viewMode == other.viewMode && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerCostListParams && this.customerId == other.customerId && this.currency == other.currency && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.viewMode == other.viewMode && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, currency, timeframeEnd, timeframeStart, viewMode, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, currency, timeframeEnd, timeframeStart, viewMode, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerCostListParams{customerId=$customerId, currency=$currency, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, viewMode=$viewMode, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerCostListParams{customerId=$customerId, currency=$currency, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, viewMode=$viewMode, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -94,8 +96,8 @@ constructor( private var timeframeEnd: OffsetDateTime? = null private var timeframeStart: OffsetDateTime? = null private var viewMode: ViewMode? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(customerCostListParams: CustomerCostListParams) = apply { @@ -104,8 +106,8 @@ constructor( this.timeframeEnd = customerCostListParams.timeframeEnd this.timeframeStart = customerCostListParams.timeframeStart this.viewMode = customerCostListParams.viewMode - additionalQueryParams(customerCostListParams.additionalQueryParams) additionalHeaders(customerCostListParams.additionalHeaders) + additionalQueryParams(customerCostListParams.additionalQueryParams) } fun customerId(customerId: String) = apply { this.customerId = customerId } @@ -128,45 +130,79 @@ constructor( */ fun viewMode(viewMode: ViewMode) = apply { this.viewMode = viewMode } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerCostListParams = CustomerCostListParams( @@ -175,8 +211,14 @@ constructor( timeframeEnd, timeframeStart, viewMode, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt index 2cb872a77..0d9f2e590 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer import com.withorb.api.core.Enum @@ -48,8 +50,8 @@ constructor( private val taxConfiguration: TaxConfiguration?, private val taxId: TaxId?, private val timezone: String?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -113,10 +115,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = CustomerCreateBody.Builder::class) @NoAutoDetect class CustomerCreateBody @@ -654,10 +656,10 @@ constructor( "CustomerCreateBody{email=$email, name=$name, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, timezone=$timezone, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -665,15 +667,15 @@ constructor( return true } - return /* spotless:off */ other is CustomerCreateParams && this.email == other.email && this.name == other.name && this.accountingSyncConfiguration == other.accountingSyncConfiguration && this.additionalEmails == other.additionalEmails && this.autoCollection == other.autoCollection && this.billingAddress == other.billingAddress && this.currency == other.currency && this.emailDelivery == other.emailDelivery && this.externalCustomerId == other.externalCustomerId && this.metadata == other.metadata && this.paymentProvider == other.paymentProvider && this.paymentProviderId == other.paymentProviderId && this.reportingConfiguration == other.reportingConfiguration && this.shippingAddress == other.shippingAddress && this.taxConfiguration == other.taxConfiguration && this.taxId == other.taxId && this.timezone == other.timezone && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreateParams && this.email == other.email && this.name == other.name && this.accountingSyncConfiguration == other.accountingSyncConfiguration && this.additionalEmails == other.additionalEmails && this.autoCollection == other.autoCollection && this.billingAddress == other.billingAddress && this.currency == other.currency && this.emailDelivery == other.emailDelivery && this.externalCustomerId == other.externalCustomerId && this.metadata == other.metadata && this.paymentProvider == other.paymentProvider && this.paymentProviderId == other.paymentProviderId && this.reportingConfiguration == other.reportingConfiguration && this.shippingAddress == other.shippingAddress && this.taxConfiguration == other.taxConfiguration && this.taxId == other.taxId && this.timezone == other.timezone && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(email, name, accountingSyncConfiguration, additionalEmails, autoCollection, billingAddress, currency, emailDelivery, externalCustomerId, metadata, paymentProvider, paymentProviderId, reportingConfiguration, shippingAddress, taxConfiguration, taxId, timezone, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(email, name, accountingSyncConfiguration, additionalEmails, autoCollection, billingAddress, currency, emailDelivery, externalCustomerId, metadata, paymentProvider, paymentProviderId, reportingConfiguration, shippingAddress, taxConfiguration, taxId, timezone, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CustomerCreateParams{email=$email, name=$name, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, timezone=$timezone, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CustomerCreateParams{email=$email, name=$name, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, timezone=$timezone, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -702,8 +704,8 @@ constructor( private var taxConfiguration: TaxConfiguration? = null private var taxId: TaxId? = null private var timezone: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -725,8 +727,8 @@ constructor( this.taxConfiguration = customerCreateParams.taxConfiguration this.taxId = customerCreateParams.taxId this.timezone = customerCreateParams.timezone - additionalQueryParams(customerCreateParams.additionalQueryParams) additionalHeaders(customerCreateParams.additionalHeaders) + additionalQueryParams(customerCreateParams.additionalQueryParams) additionalBodyProperties(customerCreateParams.additionalBodyProperties) } @@ -952,45 +954,79 @@ constructor( */ fun timezone(timezone: String) = apply { this.timezone = timezone } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -1025,8 +1061,14 @@ constructor( taxConfiguration, taxId, timezone, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } 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 1e17d03a4..8289d1896 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 @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer import com.withorb.api.core.Enum @@ -42,8 +44,8 @@ constructor( private val addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams?, private val addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun externalCustomerId(): String = externalCustomerId @@ -78,10 +80,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> externalCustomerId @@ -430,24 +432,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditLedgerCreateEntryByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && this.addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && this.addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && this.addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && this.addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerCreditLedgerCreateEntryByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && this.addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && this.addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && this.addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && this.addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(externalCustomerId, addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(externalCustomerId, addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerCreditLedgerCreateEntryByExternalIdParams{externalCustomerId=$externalCustomerId, addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerCreditLedgerCreateEntryByExternalIdParams{externalCustomerId=$externalCustomerId, addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -474,8 +476,8 @@ constructor( private var addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from( @@ -499,10 +501,10 @@ constructor( this.addAmendmentCreditLedgerEntryRequestParams = customerCreditLedgerCreateEntryByExternalIdParams .addAmendmentCreditLedgerEntryRequestParams + additionalHeaders(customerCreditLedgerCreateEntryByExternalIdParams.additionalHeaders) additionalQueryParams( customerCreditLedgerCreateEntryByExternalIdParams.additionalQueryParams ) - additionalHeaders(customerCreditLedgerCreateEntryByExternalIdParams.additionalHeaders) } fun externalCustomerId(externalCustomerId: String) = apply { @@ -564,45 +566,79 @@ constructor( addAmendmentCreditLedgerEntryRequestParams } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerCreditLedgerCreateEntryByExternalIdParams = CustomerCreditLedgerCreateEntryByExternalIdParams( @@ -614,8 +650,14 @@ constructor( addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } 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 c92c0b0de..f89fd5926 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 @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer import com.withorb.api.core.Enum @@ -42,8 +44,8 @@ constructor( private val addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams?, private val addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun customerId(): String = customerId @@ -78,10 +80,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -423,24 +425,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditLedgerCreateEntryParams && this.customerId == other.customerId && this.addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && this.addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && this.addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && this.addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && this.addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerCreditLedgerCreateEntryParams && this.customerId == other.customerId && this.addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && this.addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && this.addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && this.addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && this.addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerCreditLedgerCreateEntryParams{customerId=$customerId, addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerCreditLedgerCreateEntryParams{customerId=$customerId, addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -467,8 +469,8 @@ constructor( private var addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from( @@ -486,8 +488,8 @@ constructor( customerCreditLedgerCreateEntryParams.addVoidCreditLedgerEntryRequestParams this.addAmendmentCreditLedgerEntryRequestParams = customerCreditLedgerCreateEntryParams.addAmendmentCreditLedgerEntryRequestParams - additionalQueryParams(customerCreditLedgerCreateEntryParams.additionalQueryParams) additionalHeaders(customerCreditLedgerCreateEntryParams.additionalHeaders) + additionalQueryParams(customerCreditLedgerCreateEntryParams.additionalQueryParams) } fun customerId(customerId: String) = apply { this.customerId = customerId } @@ -547,45 +549,79 @@ constructor( addAmendmentCreditLedgerEntryRequestParams } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerCreditLedgerCreateEntryParams = CustomerCreditLedgerCreateEntryParams( @@ -595,8 +631,14 @@ constructor( addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt index abb5d3c62..3133ab484 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt @@ -3,6 +3,8 @@ package com.withorb.api.models import com.fasterxml.jackson.annotation.JsonCreator +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.JsonValue @@ -28,8 +30,8 @@ constructor( private val entryType: EntryType?, private val limit: Long?, private val minimumAmount: String?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun externalCustomerId(): String = externalCustomerId @@ -54,6 +56,8 @@ constructor( fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -79,8 +83,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> externalCustomerId @@ -88,24 +90,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditLedgerListByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.currency == other.currency && this.cursor == other.cursor && this.entryStatus == other.entryStatus && this.entryType == other.entryType && this.limit == other.limit && this.minimumAmount == other.minimumAmount && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerCreditLedgerListByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.currency == other.currency && this.cursor == other.cursor && this.entryStatus == other.entryStatus && this.entryType == other.entryType && this.limit == other.limit && this.minimumAmount == other.minimumAmount && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(externalCustomerId, createdAtGt, createdAtGte, createdAtLt, createdAtLte, currency, cursor, entryStatus, entryType, limit, minimumAmount, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(externalCustomerId, createdAtGt, createdAtGte, createdAtLt, createdAtLte, currency, cursor, entryStatus, entryType, limit, minimumAmount, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerCreditLedgerListByExternalIdParams{externalCustomerId=$externalCustomerId, createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, currency=$currency, cursor=$cursor, entryStatus=$entryStatus, entryType=$entryType, limit=$limit, minimumAmount=$minimumAmount, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerCreditLedgerListByExternalIdParams{externalCustomerId=$externalCustomerId, createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, currency=$currency, cursor=$cursor, entryStatus=$entryStatus, entryType=$entryType, limit=$limit, minimumAmount=$minimumAmount, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -128,8 +130,8 @@ constructor( private var entryType: EntryType? = null private var limit: Long? = null private var minimumAmount: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from( @@ -146,8 +148,8 @@ constructor( this.entryType = customerCreditLedgerListByExternalIdParams.entryType this.limit = customerCreditLedgerListByExternalIdParams.limit this.minimumAmount = customerCreditLedgerListByExternalIdParams.minimumAmount - additionalQueryParams(customerCreditLedgerListByExternalIdParams.additionalQueryParams) additionalHeaders(customerCreditLedgerListByExternalIdParams.additionalHeaders) + additionalQueryParams(customerCreditLedgerListByExternalIdParams.additionalQueryParams) } fun externalCustomerId(externalCustomerId: String) = apply { @@ -180,45 +182,79 @@ constructor( fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerCreditLedgerListByExternalIdParams = CustomerCreditLedgerListByExternalIdParams( @@ -235,8 +271,14 @@ constructor( entryType, limit, minimumAmount, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt index 948f463d8..c7474b6e7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt @@ -3,6 +3,8 @@ package com.withorb.api.models import com.fasterxml.jackson.annotation.JsonCreator +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.JsonValue @@ -28,8 +30,8 @@ constructor( private val entryType: EntryType?, private val limit: Long?, private val minimumAmount: String?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun customerId(): String = customerId @@ -54,6 +56,8 @@ constructor( fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -79,8 +83,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -88,24 +90,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditLedgerListParams && this.customerId == other.customerId && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.currency == other.currency && this.cursor == other.cursor && this.entryStatus == other.entryStatus && this.entryType == other.entryType && this.limit == other.limit && this.minimumAmount == other.minimumAmount && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerCreditLedgerListParams && this.customerId == other.customerId && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.currency == other.currency && this.cursor == other.cursor && this.entryStatus == other.entryStatus && this.entryType == other.entryType && this.limit == other.limit && this.minimumAmount == other.minimumAmount && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, createdAtGt, createdAtGte, createdAtLt, createdAtLte, currency, cursor, entryStatus, entryType, limit, minimumAmount, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, createdAtGt, createdAtGte, createdAtLt, createdAtLte, currency, cursor, entryStatus, entryType, limit, minimumAmount, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerCreditLedgerListParams{customerId=$customerId, createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, currency=$currency, cursor=$cursor, entryStatus=$entryStatus, entryType=$entryType, limit=$limit, minimumAmount=$minimumAmount, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerCreditLedgerListParams{customerId=$customerId, createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, currency=$currency, cursor=$cursor, entryStatus=$entryStatus, entryType=$entryType, limit=$limit, minimumAmount=$minimumAmount, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -128,8 +130,8 @@ constructor( private var entryType: EntryType? = null private var limit: Long? = null private var minimumAmount: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(customerCreditLedgerListParams: CustomerCreditLedgerListParams) = apply { @@ -144,8 +146,8 @@ constructor( this.entryType = customerCreditLedgerListParams.entryType this.limit = customerCreditLedgerListParams.limit this.minimumAmount = customerCreditLedgerListParams.minimumAmount - additionalQueryParams(customerCreditLedgerListParams.additionalQueryParams) additionalHeaders(customerCreditLedgerListParams.additionalHeaders) + additionalQueryParams(customerCreditLedgerListParams.additionalQueryParams) } fun customerId(customerId: String) = apply { this.customerId = customerId } @@ -176,45 +178,79 @@ constructor( fun minimumAmount(minimumAmount: String) = apply { this.minimumAmount = minimumAmount } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerCreditLedgerListParams = CustomerCreditLedgerListParams( @@ -229,8 +265,14 @@ constructor( entryType, limit, minimumAmount, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt index ff2149f4a..13311ae49 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -15,8 +17,8 @@ constructor( private val cursor: String?, private val includeAllBlocks: Boolean?, private val limit: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun externalCustomerId(): String = externalCustomerId @@ -29,6 +31,8 @@ constructor( fun limit(): Optional = Optional.ofNullable(limit) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -40,8 +44,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> externalCustomerId @@ -49,24 +51,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditListByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.currency == other.currency && this.cursor == other.cursor && this.includeAllBlocks == other.includeAllBlocks && this.limit == other.limit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerCreditListByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.currency == other.currency && this.cursor == other.cursor && this.includeAllBlocks == other.includeAllBlocks && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(externalCustomerId, currency, cursor, includeAllBlocks, limit, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(externalCustomerId, currency, cursor, includeAllBlocks, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerCreditListByExternalIdParams{externalCustomerId=$externalCustomerId, currency=$currency, cursor=$cursor, includeAllBlocks=$includeAllBlocks, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerCreditListByExternalIdParams{externalCustomerId=$externalCustomerId, currency=$currency, cursor=$cursor, includeAllBlocks=$includeAllBlocks, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -83,8 +85,8 @@ constructor( private var cursor: String? = null private var includeAllBlocks: Boolean? = null private var limit: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from( @@ -95,8 +97,8 @@ constructor( this.cursor = customerCreditListByExternalIdParams.cursor this.includeAllBlocks = customerCreditListByExternalIdParams.includeAllBlocks this.limit = customerCreditListByExternalIdParams.limit - additionalQueryParams(customerCreditListByExternalIdParams.additionalQueryParams) additionalHeaders(customerCreditListByExternalIdParams.additionalHeaders) + additionalQueryParams(customerCreditListByExternalIdParams.additionalQueryParams) } fun externalCustomerId(externalCustomerId: String) = apply { @@ -120,45 +122,79 @@ constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long) = apply { this.limit = limit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerCreditListByExternalIdParams = CustomerCreditListByExternalIdParams( @@ -169,8 +205,14 @@ constructor( cursor, includeAllBlocks, limit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListParams.kt index e709d08f0..92d677729 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -15,8 +17,8 @@ constructor( private val cursor: String?, private val includeAllBlocks: Boolean?, private val limit: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun customerId(): String = customerId @@ -29,6 +31,8 @@ constructor( fun limit(): Optional = Optional.ofNullable(limit) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -40,8 +44,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -49,24 +51,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditListParams && this.customerId == other.customerId && this.currency == other.currency && this.cursor == other.cursor && this.includeAllBlocks == other.includeAllBlocks && this.limit == other.limit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerCreditListParams && this.customerId == other.customerId && this.currency == other.currency && this.cursor == other.cursor && this.includeAllBlocks == other.includeAllBlocks && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, currency, cursor, includeAllBlocks, limit, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, currency, cursor, includeAllBlocks, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerCreditListParams{customerId=$customerId, currency=$currency, cursor=$cursor, includeAllBlocks=$includeAllBlocks, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerCreditListParams{customerId=$customerId, currency=$currency, cursor=$cursor, includeAllBlocks=$includeAllBlocks, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -83,8 +85,8 @@ constructor( private var cursor: String? = null private var includeAllBlocks: Boolean? = null private var limit: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(customerCreditListParams: CustomerCreditListParams) = apply { @@ -93,8 +95,8 @@ constructor( this.cursor = customerCreditListParams.cursor this.includeAllBlocks = customerCreditListParams.includeAllBlocks this.limit = customerCreditListParams.limit - additionalQueryParams(customerCreditListParams.additionalQueryParams) additionalHeaders(customerCreditListParams.additionalHeaders) + additionalQueryParams(customerCreditListParams.additionalQueryParams) } fun customerId(customerId: String) = apply { this.customerId = customerId } @@ -116,45 +118,79 @@ constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long) = apply { this.limit = limit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerCreditListParams = CustomerCreditListParams( @@ -163,8 +199,14 @@ constructor( cursor, includeAllBlocks, limit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt index e0ab2961a..9911cd0c9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField @@ -28,8 +30,8 @@ constructor( private val threshold: String, private val expiresAfter: Long?, private val expiresAfterUnit: ExpiresAfterUnit?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -63,10 +65,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> externalCustomerId @@ -249,10 +251,10 @@ constructor( "CustomerCreditTopUpCreateByExternalIdBody{amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -260,15 +262,15 @@ constructor( return true } - return /* spotless:off */ other is CustomerCreditTopUpCreateByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.amount == other.amount && this.currency == other.currency && this.invoiceSettings == other.invoiceSettings && this.perUnitCostBasis == other.perUnitCostBasis && this.threshold == other.threshold && this.expiresAfter == other.expiresAfter && this.expiresAfterUnit == other.expiresAfterUnit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpCreateByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.amount == other.amount && this.currency == other.currency && this.invoiceSettings == other.invoiceSettings && this.perUnitCostBasis == other.perUnitCostBasis && this.threshold == other.threshold && this.expiresAfter == other.expiresAfter && this.expiresAfterUnit == other.expiresAfterUnit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(externalCustomerId, amount, currency, invoiceSettings, perUnitCostBasis, threshold, expiresAfter, expiresAfterUnit, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(externalCustomerId, amount, currency, invoiceSettings, perUnitCostBasis, threshold, expiresAfter, expiresAfterUnit, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CustomerCreditTopUpCreateByExternalIdParams{externalCustomerId=$externalCustomerId, amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CustomerCreditTopUpCreateByExternalIdParams{externalCustomerId=$externalCustomerId, amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -288,8 +290,8 @@ constructor( private var threshold: String? = null private var expiresAfter: Long? = null private var expiresAfterUnit: ExpiresAfterUnit? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -304,8 +306,8 @@ constructor( this.threshold = customerCreditTopUpCreateByExternalIdParams.threshold this.expiresAfter = customerCreditTopUpCreateByExternalIdParams.expiresAfter this.expiresAfterUnit = customerCreditTopUpCreateByExternalIdParams.expiresAfterUnit - additionalQueryParams(customerCreditTopUpCreateByExternalIdParams.additionalQueryParams) additionalHeaders(customerCreditTopUpCreateByExternalIdParams.additionalHeaders) + additionalQueryParams(customerCreditTopUpCreateByExternalIdParams.additionalQueryParams) additionalBodyProperties( customerCreditTopUpCreateByExternalIdParams.additionalBodyProperties ) @@ -351,45 +353,79 @@ constructor( this.expiresAfterUnit = expiresAfterUnit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -417,8 +453,14 @@ constructor( checkNotNull(threshold) { "`threshold` is required but was not set" }, expiresAfter, expiresAfterUnit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt index c29a8369b..eda3fa771 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField @@ -28,8 +30,8 @@ constructor( private val threshold: String, private val expiresAfter: Long?, private val expiresAfterUnit: ExpiresAfterUnit?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -63,10 +65,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -248,10 +250,10 @@ constructor( "CustomerCreditTopUpCreateBody{amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -259,15 +261,15 @@ constructor( return true } - return /* spotless:off */ other is CustomerCreditTopUpCreateParams && this.customerId == other.customerId && this.amount == other.amount && this.currency == other.currency && this.invoiceSettings == other.invoiceSettings && this.perUnitCostBasis == other.perUnitCostBasis && this.threshold == other.threshold && this.expiresAfter == other.expiresAfter && this.expiresAfterUnit == other.expiresAfterUnit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpCreateParams && this.customerId == other.customerId && this.amount == other.amount && this.currency == other.currency && this.invoiceSettings == other.invoiceSettings && this.perUnitCostBasis == other.perUnitCostBasis && this.threshold == other.threshold && this.expiresAfter == other.expiresAfter && this.expiresAfterUnit == other.expiresAfterUnit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, amount, currency, invoiceSettings, perUnitCostBasis, threshold, expiresAfter, expiresAfterUnit, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, amount, currency, invoiceSettings, perUnitCostBasis, threshold, expiresAfter, expiresAfterUnit, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CustomerCreditTopUpCreateParams{customerId=$customerId, amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CustomerCreditTopUpCreateParams{customerId=$customerId, amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -287,8 +289,8 @@ constructor( private var threshold: String? = null private var expiresAfter: Long? = null private var expiresAfterUnit: ExpiresAfterUnit? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -302,8 +304,8 @@ constructor( this.threshold = customerCreditTopUpCreateParams.threshold this.expiresAfter = customerCreditTopUpCreateParams.expiresAfter this.expiresAfterUnit = customerCreditTopUpCreateParams.expiresAfterUnit - additionalQueryParams(customerCreditTopUpCreateParams.additionalQueryParams) additionalHeaders(customerCreditTopUpCreateParams.additionalHeaders) + additionalQueryParams(customerCreditTopUpCreateParams.additionalQueryParams) additionalBodyProperties(customerCreditTopUpCreateParams.additionalBodyProperties) } @@ -345,45 +347,79 @@ constructor( this.expiresAfterUnit = expiresAfterUnit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -409,8 +445,14 @@ constructor( checkNotNull(threshold) { "`threshold` is required but was not set" }, expiresAfter, expiresAfterUnit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt index db5b1e5ff..24a44daac 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable @@ -13,8 +15,8 @@ class CustomerCreditTopUpDeleteByExternalIdParams constructor( private val externalCustomerId: String, private val topUpId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -27,10 +29,10 @@ constructor( return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> externalCustomerId @@ -39,10 +41,10 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -50,15 +52,15 @@ constructor( return true } - return /* spotless:off */ other is CustomerCreditTopUpDeleteByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.topUpId == other.topUpId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpDeleteByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.topUpId == other.topUpId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(externalCustomerId, topUpId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(externalCustomerId, topUpId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CustomerCreditTopUpDeleteByExternalIdParams{externalCustomerId=$externalCustomerId, topUpId=$topUpId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CustomerCreditTopUpDeleteByExternalIdParams{externalCustomerId=$externalCustomerId, topUpId=$topUpId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -72,8 +74,8 @@ constructor( private var externalCustomerId: String? = null private var topUpId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -82,8 +84,8 @@ constructor( ) = apply { this.externalCustomerId = customerCreditTopUpDeleteByExternalIdParams.externalCustomerId this.topUpId = customerCreditTopUpDeleteByExternalIdParams.topUpId - additionalQueryParams(customerCreditTopUpDeleteByExternalIdParams.additionalQueryParams) additionalHeaders(customerCreditTopUpDeleteByExternalIdParams.additionalHeaders) + additionalQueryParams(customerCreditTopUpDeleteByExternalIdParams.additionalQueryParams) additionalBodyProperties( customerCreditTopUpDeleteByExternalIdParams.additionalBodyProperties ) @@ -95,45 +97,79 @@ constructor( fun topUpId(topUpId: String) = apply { this.topUpId = topUpId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -155,8 +191,14 @@ constructor( "`externalCustomerId` is required but was not set" }, checkNotNull(topUpId) { "`topUpId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt index 122c7725f..afdedf01a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable @@ -13,8 +15,8 @@ class CustomerCreditTopUpDeleteParams constructor( private val customerId: String, private val topUpId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -27,10 +29,10 @@ constructor( return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -39,10 +41,10 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -50,15 +52,15 @@ constructor( return true } - return /* spotless:off */ other is CustomerCreditTopUpDeleteParams && this.customerId == other.customerId && this.topUpId == other.topUpId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpDeleteParams && this.customerId == other.customerId && this.topUpId == other.topUpId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, topUpId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, topUpId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CustomerCreditTopUpDeleteParams{customerId=$customerId, topUpId=$topUpId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CustomerCreditTopUpDeleteParams{customerId=$customerId, topUpId=$topUpId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -72,8 +74,8 @@ constructor( private var customerId: String? = null private var topUpId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -81,8 +83,8 @@ constructor( apply { this.customerId = customerCreditTopUpDeleteParams.customerId this.topUpId = customerCreditTopUpDeleteParams.topUpId - additionalQueryParams(customerCreditTopUpDeleteParams.additionalQueryParams) additionalHeaders(customerCreditTopUpDeleteParams.additionalHeaders) + additionalQueryParams(customerCreditTopUpDeleteParams.additionalQueryParams) additionalBodyProperties(customerCreditTopUpDeleteParams.additionalBodyProperties) } @@ -90,45 +92,79 @@ constructor( fun topUpId(topUpId: String) = apply { this.topUpId = topUpId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -148,8 +184,14 @@ constructor( CustomerCreditTopUpDeleteParams( checkNotNull(customerId) { "`customerId` is required but was not set" }, checkNotNull(topUpId) { "`topUpId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdParams.kt index 9d0d4bbd7..edf54644d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -13,8 +15,8 @@ constructor( private val externalCustomerId: String, private val cursor: String?, private val limit: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun externalCustomerId(): String = externalCustomerId @@ -23,6 +25,8 @@ constructor( fun limit(): Optional = Optional.ofNullable(limit) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -32,8 +36,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> externalCustomerId @@ -41,24 +43,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditTopUpListByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.cursor == other.cursor && this.limit == other.limit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpListByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.cursor == other.cursor && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(externalCustomerId, cursor, limit, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(externalCustomerId, cursor, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerCreditTopUpListByExternalIdParams{externalCustomerId=$externalCustomerId, cursor=$cursor, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerCreditTopUpListByExternalIdParams{externalCustomerId=$externalCustomerId, cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -73,8 +75,8 @@ constructor( private var externalCustomerId: String? = null private var cursor: String? = null private var limit: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from( @@ -83,8 +85,8 @@ constructor( this.externalCustomerId = customerCreditTopUpListByExternalIdParams.externalCustomerId this.cursor = customerCreditTopUpListByExternalIdParams.cursor this.limit = customerCreditTopUpListByExternalIdParams.limit - additionalQueryParams(customerCreditTopUpListByExternalIdParams.additionalQueryParams) additionalHeaders(customerCreditTopUpListByExternalIdParams.additionalHeaders) + additionalQueryParams(customerCreditTopUpListByExternalIdParams.additionalQueryParams) } fun externalCustomerId(externalCustomerId: String) = apply { @@ -100,45 +102,79 @@ constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long) = apply { this.limit = limit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerCreditTopUpListByExternalIdParams = CustomerCreditTopUpListByExternalIdParams( @@ -147,8 +183,14 @@ constructor( }, cursor, limit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListParams.kt index a9c8c3cb0..7581cb1ca 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -13,8 +15,8 @@ constructor( private val customerId: String, private val cursor: String?, private val limit: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun customerId(): String = customerId @@ -23,6 +25,8 @@ constructor( fun limit(): Optional = Optional.ofNullable(limit) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -32,8 +36,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -41,24 +43,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerCreditTopUpListParams && this.customerId == other.customerId && this.cursor == other.cursor && this.limit == other.limit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpListParams && this.customerId == other.customerId && this.cursor == other.cursor && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, cursor, limit, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, cursor, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerCreditTopUpListParams{customerId=$customerId, cursor=$cursor, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerCreditTopUpListParams{customerId=$customerId, cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -73,16 +75,16 @@ constructor( private var customerId: String? = null private var cursor: String? = null private var limit: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(customerCreditTopUpListParams: CustomerCreditTopUpListParams) = apply { this.customerId = customerCreditTopUpListParams.customerId this.cursor = customerCreditTopUpListParams.cursor this.limit = customerCreditTopUpListParams.limit - additionalQueryParams(customerCreditTopUpListParams.additionalQueryParams) additionalHeaders(customerCreditTopUpListParams.additionalHeaders) + additionalQueryParams(customerCreditTopUpListParams.additionalQueryParams) } fun customerId(customerId: String) = apply { this.customerId = customerId } @@ -96,53 +98,93 @@ constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long) = apply { this.limit = limit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerCreditTopUpListParams = CustomerCreditTopUpListParams( checkNotNull(customerId) { "`customerId` is required but was not set" }, cursor, limit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt index d84ec8e0f..1e324250e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable @@ -12,8 +14,8 @@ import java.util.Optional class CustomerDeleteParams constructor( private val customerId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -24,10 +26,10 @@ constructor( return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -35,10 +37,10 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -46,15 +48,15 @@ constructor( return true } - return /* spotless:off */ other is CustomerDeleteParams && this.customerId == other.customerId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerDeleteParams && this.customerId == other.customerId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CustomerDeleteParams{customerId=$customerId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CustomerDeleteParams{customerId=$customerId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -67,59 +69,93 @@ constructor( class Builder { private var customerId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(customerDeleteParams: CustomerDeleteParams) = apply { this.customerId = customerDeleteParams.customerId - additionalQueryParams(customerDeleteParams.additionalQueryParams) additionalHeaders(customerDeleteParams.additionalHeaders) + additionalQueryParams(customerDeleteParams.additionalQueryParams) additionalBodyProperties(customerDeleteParams.additionalBodyProperties) } fun customerId(customerId: String) = apply { this.customerId = customerId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -138,8 +174,14 @@ constructor( fun build(): CustomerDeleteParams = CustomerDeleteParams( checkNotNull(customerId) { "`customerId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchByExternalIdParams.kt index bfad4843d..c26a6d2c7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchByExternalIdParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class CustomerFetchByExternalIdParams constructor( private val externalCustomerId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun externalCustomerId(): String = externalCustomerId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> externalCustomerId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerFetchByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerFetchByExternalIdParams && this.externalCustomerId == other.externalCustomerId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(externalCustomerId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(externalCustomerId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerFetchByExternalIdParams{externalCustomerId=$externalCustomerId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerFetchByExternalIdParams{externalCustomerId=$externalCustomerId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,68 +59,108 @@ constructor( class Builder { private var externalCustomerId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(customerFetchByExternalIdParams: CustomerFetchByExternalIdParams) = apply { this.externalCustomerId = customerFetchByExternalIdParams.externalCustomerId - additionalQueryParams(customerFetchByExternalIdParams.additionalQueryParams) additionalHeaders(customerFetchByExternalIdParams.additionalHeaders) + additionalQueryParams(customerFetchByExternalIdParams.additionalQueryParams) } fun externalCustomerId(externalCustomerId: String) = apply { this.externalCustomerId = externalCustomerId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerFetchByExternalIdParams = CustomerFetchByExternalIdParams( checkNotNull(externalCustomerId) { "`externalCustomerId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchParams.kt index bbc48f421..28d9ea7d3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerFetchParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class CustomerFetchParams constructor( private val customerId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun customerId(): String = customerId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerFetchParams && this.customerId == other.customerId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerFetchParams && this.customerId == other.customerId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerFetchParams{customerId=$customerId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerFetchParams{customerId=$customerId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,63 +59,103 @@ constructor( class Builder { private var customerId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(customerFetchParams: CustomerFetchParams) = apply { this.customerId = customerFetchParams.customerId - additionalQueryParams(customerFetchParams.additionalQueryParams) additionalHeaders(customerFetchParams.additionalHeaders) + additionalQueryParams(customerFetchParams.additionalQueryParams) } fun customerId(customerId: String) = apply { this.customerId = customerId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerFetchParams = CustomerFetchParams( checkNotNull(customerId) { "`customerId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt index 2969e7cc7..cceb25fa8 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -18,8 +20,8 @@ constructor( private val createdAtLte: OffsetDateTime?, private val cursor: String?, private val limit: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun createdAtGt(): Optional = Optional.ofNullable(createdAtGt) @@ -34,6 +36,8 @@ constructor( fun limit(): Optional = Optional.ofNullable(limit) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -55,26 +59,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is CustomerListParams && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.cursor == other.cursor && this.limit == other.limit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is CustomerListParams && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.cursor == other.cursor && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(createdAtGt, createdAtGte, createdAtLt, createdAtLte, cursor, limit, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(createdAtGt, createdAtGte, createdAtLt, createdAtLte, cursor, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "CustomerListParams{createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, cursor=$cursor, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "CustomerListParams{createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -92,8 +94,8 @@ constructor( private var createdAtLte: OffsetDateTime? = null private var cursor: String? = null private var limit: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(customerListParams: CustomerListParams) = apply { @@ -103,8 +105,8 @@ constructor( this.createdAtLte = customerListParams.createdAtLte this.cursor = customerListParams.cursor this.limit = customerListParams.limit - additionalQueryParams(customerListParams.additionalQueryParams) additionalHeaders(customerListParams.additionalHeaders) + additionalQueryParams(customerListParams.additionalQueryParams) } fun createdAtGt(createdAtGt: OffsetDateTime) = apply { this.createdAtGt = createdAtGt } @@ -124,45 +126,79 @@ constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long) = apply { this.limit = limit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): CustomerListParams = CustomerListParams( @@ -172,8 +208,14 @@ constructor( createdAtLte, cursor, limit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt index 6daa87a35..6cfbedbdd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer import com.withorb.api.core.Enum @@ -48,8 +50,8 @@ constructor( private val shippingAddress: ShippingAddress?, private val taxConfiguration: TaxConfiguration?, private val taxId: TaxId?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -112,10 +114,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> id @@ -642,10 +644,10 @@ constructor( "CustomerUpdateByExternalIdBody{accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, email=$email, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -653,15 +655,15 @@ constructor( return true } - return /* spotless:off */ other is CustomerUpdateByExternalIdParams && this.id == other.id && this.accountingSyncConfiguration == other.accountingSyncConfiguration && this.additionalEmails == other.additionalEmails && this.autoCollection == other.autoCollection && this.billingAddress == other.billingAddress && this.currency == other.currency && this.email == other.email && this.emailDelivery == other.emailDelivery && this.externalCustomerId == other.externalCustomerId && this.metadata == other.metadata && this.name == other.name && this.paymentProvider == other.paymentProvider && this.paymentProviderId == other.paymentProviderId && this.reportingConfiguration == other.reportingConfiguration && this.shippingAddress == other.shippingAddress && this.taxConfiguration == other.taxConfiguration && this.taxId == other.taxId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerUpdateByExternalIdParams && this.id == other.id && this.accountingSyncConfiguration == other.accountingSyncConfiguration && this.additionalEmails == other.additionalEmails && this.autoCollection == other.autoCollection && this.billingAddress == other.billingAddress && this.currency == other.currency && this.email == other.email && this.emailDelivery == other.emailDelivery && this.externalCustomerId == other.externalCustomerId && this.metadata == other.metadata && this.name == other.name && this.paymentProvider == other.paymentProvider && this.paymentProviderId == other.paymentProviderId && this.reportingConfiguration == other.reportingConfiguration && this.shippingAddress == other.shippingAddress && this.taxConfiguration == other.taxConfiguration && this.taxId == other.taxId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(id, accountingSyncConfiguration, additionalEmails, autoCollection, billingAddress, currency, email, emailDelivery, externalCustomerId, metadata, name, paymentProvider, paymentProviderId, reportingConfiguration, shippingAddress, taxConfiguration, taxId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(id, accountingSyncConfiguration, additionalEmails, autoCollection, billingAddress, currency, email, emailDelivery, externalCustomerId, metadata, name, paymentProvider, paymentProviderId, reportingConfiguration, shippingAddress, taxConfiguration, taxId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CustomerUpdateByExternalIdParams{id=$id, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, email=$email, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CustomerUpdateByExternalIdParams{id=$id, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, email=$email, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -690,8 +692,8 @@ constructor( private var shippingAddress: ShippingAddress? = null private var taxConfiguration: TaxConfiguration? = null private var taxId: TaxId? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -716,8 +718,8 @@ constructor( this.shippingAddress = customerUpdateByExternalIdParams.shippingAddress this.taxConfiguration = customerUpdateByExternalIdParams.taxConfiguration this.taxId = customerUpdateByExternalIdParams.taxId - additionalQueryParams(customerUpdateByExternalIdParams.additionalQueryParams) additionalHeaders(customerUpdateByExternalIdParams.additionalHeaders) + additionalQueryParams(customerUpdateByExternalIdParams.additionalQueryParams) additionalBodyProperties(customerUpdateByExternalIdParams.additionalBodyProperties) } @@ -937,45 +939,79 @@ constructor( */ fun taxId(taxId: TaxId) = apply { this.taxId = taxId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -1010,8 +1046,14 @@ constructor( shippingAddress, taxConfiguration, taxId, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt index fea9c9567..fc53c6842 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer import com.withorb.api.core.Enum @@ -48,8 +50,8 @@ constructor( private val shippingAddress: ShippingAddress?, private val taxConfiguration: TaxConfiguration?, private val taxId: TaxId?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -112,10 +114,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> customerId @@ -639,10 +641,10 @@ constructor( "CustomerUpdateBody{accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, email=$email, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -650,15 +652,15 @@ constructor( return true } - return /* spotless:off */ other is CustomerUpdateParams && this.customerId == other.customerId && this.accountingSyncConfiguration == other.accountingSyncConfiguration && this.additionalEmails == other.additionalEmails && this.autoCollection == other.autoCollection && this.billingAddress == other.billingAddress && this.currency == other.currency && this.email == other.email && this.emailDelivery == other.emailDelivery && this.externalCustomerId == other.externalCustomerId && this.metadata == other.metadata && this.name == other.name && this.paymentProvider == other.paymentProvider && this.paymentProviderId == other.paymentProviderId && this.reportingConfiguration == other.reportingConfiguration && this.shippingAddress == other.shippingAddress && this.taxConfiguration == other.taxConfiguration && this.taxId == other.taxId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerUpdateParams && this.customerId == other.customerId && this.accountingSyncConfiguration == other.accountingSyncConfiguration && this.additionalEmails == other.additionalEmails && this.autoCollection == other.autoCollection && this.billingAddress == other.billingAddress && this.currency == other.currency && this.email == other.email && this.emailDelivery == other.emailDelivery && this.externalCustomerId == other.externalCustomerId && this.metadata == other.metadata && this.name == other.name && this.paymentProvider == other.paymentProvider && this.paymentProviderId == other.paymentProviderId && this.reportingConfiguration == other.reportingConfiguration && this.shippingAddress == other.shippingAddress && this.taxConfiguration == other.taxConfiguration && this.taxId == other.taxId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(customerId, accountingSyncConfiguration, additionalEmails, autoCollection, billingAddress, currency, email, emailDelivery, externalCustomerId, metadata, name, paymentProvider, paymentProviderId, reportingConfiguration, shippingAddress, taxConfiguration, taxId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(customerId, accountingSyncConfiguration, additionalEmails, autoCollection, billingAddress, currency, email, emailDelivery, externalCustomerId, metadata, name, paymentProvider, paymentProviderId, reportingConfiguration, shippingAddress, taxConfiguration, taxId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CustomerUpdateParams{customerId=$customerId, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, email=$email, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CustomerUpdateParams{customerId=$customerId, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, email=$email, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -687,8 +689,8 @@ constructor( private var shippingAddress: ShippingAddress? = null private var taxConfiguration: TaxConfiguration? = null private var taxId: TaxId? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -710,8 +712,8 @@ constructor( this.shippingAddress = customerUpdateParams.shippingAddress this.taxConfiguration = customerUpdateParams.taxConfiguration this.taxId = customerUpdateParams.taxId - additionalQueryParams(customerUpdateParams.additionalQueryParams) additionalHeaders(customerUpdateParams.additionalHeaders) + additionalQueryParams(customerUpdateParams.additionalQueryParams) additionalBodyProperties(customerUpdateParams.additionalBodyProperties) } @@ -931,45 +933,79 @@ constructor( */ fun taxId(taxId: TaxId) = apply { this.taxId = taxId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -1004,8 +1040,14 @@ constructor( shippingAddress, taxConfiguration, taxId, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt index 95257f919..e17baa40b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable @@ -12,8 +14,8 @@ import java.util.Optional class EventBackfillCloseParams constructor( private val backfillId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -24,10 +26,10 @@ constructor( return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> backfillId @@ -35,10 +37,10 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -46,15 +48,15 @@ constructor( return true } - return /* spotless:off */ other is EventBackfillCloseParams && this.backfillId == other.backfillId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is EventBackfillCloseParams && this.backfillId == other.backfillId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(backfillId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(backfillId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "EventBackfillCloseParams{backfillId=$backfillId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "EventBackfillCloseParams{backfillId=$backfillId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -67,59 +69,93 @@ constructor( class Builder { private var backfillId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventBackfillCloseParams: EventBackfillCloseParams) = apply { this.backfillId = eventBackfillCloseParams.backfillId - additionalQueryParams(eventBackfillCloseParams.additionalQueryParams) additionalHeaders(eventBackfillCloseParams.additionalHeaders) + additionalQueryParams(eventBackfillCloseParams.additionalQueryParams) additionalBodyProperties(eventBackfillCloseParams.additionalBodyProperties) } fun backfillId(backfillId: String) = apply { this.backfillId = backfillId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -138,8 +174,14 @@ constructor( fun build(): EventBackfillCloseParams = EventBackfillCloseParams( checkNotNull(backfillId) { "`backfillId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt index 602001ccf..a98da2049 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -24,8 +26,8 @@ constructor( private val deprecationFilter: String?, private val externalCustomerId: String?, private val replaceExistingEvents: Boolean?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -57,10 +59,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = EventBackfillCreateBody.Builder::class) @NoAutoDetect class EventBackfillCreateBody @@ -251,10 +253,10 @@ constructor( "EventBackfillCreateBody{timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, closeTime=$closeTime, customerId=$customerId, deprecationFilter=$deprecationFilter, externalCustomerId=$externalCustomerId, replaceExistingEvents=$replaceExistingEvents, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -262,15 +264,15 @@ constructor( return true } - return /* spotless:off */ other is EventBackfillCreateParams && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.closeTime == other.closeTime && this.customerId == other.customerId && this.deprecationFilter == other.deprecationFilter && this.externalCustomerId == other.externalCustomerId && this.replaceExistingEvents == other.replaceExistingEvents && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is EventBackfillCreateParams && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.closeTime == other.closeTime && this.customerId == other.customerId && this.deprecationFilter == other.deprecationFilter && this.externalCustomerId == other.externalCustomerId && this.replaceExistingEvents == other.replaceExistingEvents && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(timeframeEnd, timeframeStart, closeTime, customerId, deprecationFilter, externalCustomerId, replaceExistingEvents, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(timeframeEnd, timeframeStart, closeTime, customerId, deprecationFilter, externalCustomerId, replaceExistingEvents, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "EventBackfillCreateParams{timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, closeTime=$closeTime, customerId=$customerId, deprecationFilter=$deprecationFilter, externalCustomerId=$externalCustomerId, replaceExistingEvents=$replaceExistingEvents, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "EventBackfillCreateParams{timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, closeTime=$closeTime, customerId=$customerId, deprecationFilter=$deprecationFilter, externalCustomerId=$externalCustomerId, replaceExistingEvents=$replaceExistingEvents, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -289,8 +291,8 @@ constructor( private var deprecationFilter: String? = null private var externalCustomerId: String? = null private var replaceExistingEvents: Boolean? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -302,8 +304,8 @@ constructor( this.deprecationFilter = eventBackfillCreateParams.deprecationFilter this.externalCustomerId = eventBackfillCreateParams.externalCustomerId this.replaceExistingEvents = eventBackfillCreateParams.replaceExistingEvents - additionalQueryParams(eventBackfillCreateParams.additionalQueryParams) additionalHeaders(eventBackfillCreateParams.additionalHeaders) + additionalQueryParams(eventBackfillCreateParams.additionalQueryParams) additionalBodyProperties(eventBackfillCreateParams.additionalBodyProperties) } @@ -353,45 +355,79 @@ constructor( this.replaceExistingEvents = replaceExistingEvents } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -416,8 +452,14 @@ constructor( deprecationFilter, externalCustomerId, replaceExistingEvents, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchParams.kt index fc6b6cc2f..45083a1b4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillFetchParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class EventBackfillFetchParams constructor( private val backfillId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun backfillId(): String = backfillId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> backfillId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is EventBackfillFetchParams && this.backfillId == other.backfillId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is EventBackfillFetchParams && this.backfillId == other.backfillId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(backfillId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(backfillId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "EventBackfillFetchParams{backfillId=$backfillId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "EventBackfillFetchParams{backfillId=$backfillId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,63 +59,103 @@ constructor( class Builder { private var backfillId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(eventBackfillFetchParams: EventBackfillFetchParams) = apply { this.backfillId = eventBackfillFetchParams.backfillId - additionalQueryParams(eventBackfillFetchParams.additionalQueryParams) additionalHeaders(eventBackfillFetchParams.additionalHeaders) + additionalQueryParams(eventBackfillFetchParams.additionalQueryParams) } fun backfillId(backfillId: String) = apply { this.backfillId = backfillId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): EventBackfillFetchParams = EventBackfillFetchParams( checkNotNull(backfillId) { "`backfillId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListParams.kt index 1876e774d..738e1923e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -12,14 +14,16 @@ class EventBackfillListParams constructor( private val cursor: String?, private val limit: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun cursor(): Optional = Optional.ofNullable(cursor) fun limit(): Optional = Optional.ofNullable(limit) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -29,26 +33,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is EventBackfillListParams && this.cursor == other.cursor && this.limit == other.limit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is EventBackfillListParams && this.cursor == other.cursor && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(cursor, limit, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(cursor, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "EventBackfillListParams{cursor=$cursor, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "EventBackfillListParams{cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -62,15 +64,15 @@ constructor( private var cursor: String? = null private var limit: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(eventBackfillListParams: EventBackfillListParams) = apply { this.cursor = eventBackfillListParams.cursor this.limit = eventBackfillListParams.limit - additionalQueryParams(eventBackfillListParams.additionalQueryParams) additionalHeaders(eventBackfillListParams.additionalHeaders) + additionalQueryParams(eventBackfillListParams.additionalQueryParams) } /** @@ -82,52 +84,92 @@ constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long) = apply { this.limit = limit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): EventBackfillListParams = EventBackfillListParams( cursor, limit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt index 95f7cd1c5..c68270d7a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable @@ -12,8 +14,8 @@ import java.util.Optional class EventBackfillRevertParams constructor( private val backfillId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -24,10 +26,10 @@ constructor( return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> backfillId @@ -35,10 +37,10 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -46,15 +48,15 @@ constructor( return true } - return /* spotless:off */ other is EventBackfillRevertParams && this.backfillId == other.backfillId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is EventBackfillRevertParams && this.backfillId == other.backfillId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(backfillId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(backfillId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "EventBackfillRevertParams{backfillId=$backfillId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "EventBackfillRevertParams{backfillId=$backfillId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -67,59 +69,93 @@ constructor( class Builder { private var backfillId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventBackfillRevertParams: EventBackfillRevertParams) = apply { this.backfillId = eventBackfillRevertParams.backfillId - additionalQueryParams(eventBackfillRevertParams.additionalQueryParams) additionalHeaders(eventBackfillRevertParams.additionalHeaders) + additionalQueryParams(eventBackfillRevertParams.additionalQueryParams) additionalBodyProperties(eventBackfillRevertParams.additionalBodyProperties) } fun backfillId(backfillId: String) = apply { this.backfillId = backfillId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -138,8 +174,14 @@ constructor( fun build(): EventBackfillRevertParams = EventBackfillRevertParams( checkNotNull(backfillId) { "`backfillId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt index f7b684b03..0802ce80b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable @@ -12,8 +14,8 @@ import java.util.Optional class EventDeprecateParams constructor( private val eventId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -24,10 +26,10 @@ constructor( return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> eventId @@ -35,10 +37,10 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -46,15 +48,15 @@ constructor( return true } - return /* spotless:off */ other is EventDeprecateParams && this.eventId == other.eventId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is EventDeprecateParams && this.eventId == other.eventId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(eventId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(eventId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "EventDeprecateParams{eventId=$eventId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "EventDeprecateParams{eventId=$eventId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -67,59 +69,93 @@ constructor( class Builder { private var eventId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventDeprecateParams: EventDeprecateParams) = apply { this.eventId = eventDeprecateParams.eventId - additionalQueryParams(eventDeprecateParams.additionalQueryParams) additionalHeaders(eventDeprecateParams.additionalHeaders) + additionalQueryParams(eventDeprecateParams.additionalQueryParams) additionalBodyProperties(eventDeprecateParams.additionalBodyProperties) } fun eventId(eventId: String) = apply { this.eventId = eventId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -138,8 +174,14 @@ constructor( fun build(): EventDeprecateParams = EventDeprecateParams( checkNotNull(eventId) { "`eventId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt index ba5cb6aad..8526b71cd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -20,8 +22,8 @@ constructor( private val events: List, private val backfillId: String?, private val debug: Boolean?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -36,6 +38,8 @@ constructor( return EventIngestBody(events, additionalBodyProperties) } + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -45,8 +49,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - @JsonDeserialize(builder = EventIngestBody.Builder::class) @NoAutoDetect class EventIngestBody @@ -123,10 +125,10 @@ constructor( "EventIngestBody{events=$events, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -134,15 +136,15 @@ constructor( return true } - return /* spotless:off */ other is EventIngestParams && this.events == other.events && this.backfillId == other.backfillId && this.debug == other.debug && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is EventIngestParams && this.events == other.events && this.backfillId == other.backfillId && this.debug == other.debug && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(events, backfillId, debug, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(events, backfillId, debug, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "EventIngestParams{events=$events, backfillId=$backfillId, debug=$debug, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "EventIngestParams{events=$events, backfillId=$backfillId, debug=$debug, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -157,8 +159,8 @@ constructor( private var events: MutableList = mutableListOf() private var backfillId: String? = null private var debug: Boolean? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -166,8 +168,8 @@ constructor( this.events(eventIngestParams.events) this.backfillId = eventIngestParams.backfillId this.debug = eventIngestParams.debug - additionalQueryParams(eventIngestParams.additionalQueryParams) additionalHeaders(eventIngestParams.additionalHeaders) + additionalQueryParams(eventIngestParams.additionalQueryParams) additionalBodyProperties(eventIngestParams.additionalBodyProperties) } @@ -187,45 +189,79 @@ constructor( /** Flag to enable additional debug information in the endpoint response */ fun debug(debug: Boolean) = apply { this.debug = debug } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -246,8 +282,14 @@ constructor( checkNotNull(events) { "`events` is required but was not set" }.toImmutable(), backfillId, debug, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt index 6b1ac2c05..cfd9ffb63 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -20,8 +22,8 @@ constructor( private val eventIds: List, private val timeframeEnd: OffsetDateTime?, private val timeframeStart: OffsetDateTime?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -41,10 +43,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = EventSearchBody.Builder::class) @NoAutoDetect class EventSearchBody @@ -171,10 +173,10 @@ constructor( "EventSearchBody{eventIds=$eventIds, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -182,15 +184,15 @@ constructor( return true } - return /* spotless:off */ other is EventSearchParams && this.eventIds == other.eventIds && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is EventSearchParams && this.eventIds == other.eventIds && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(eventIds, timeframeEnd, timeframeStart, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(eventIds, timeframeEnd, timeframeStart, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "EventSearchParams{eventIds=$eventIds, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "EventSearchParams{eventIds=$eventIds, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -205,8 +207,8 @@ constructor( private var eventIds: MutableList = mutableListOf() private var timeframeEnd: OffsetDateTime? = null private var timeframeStart: OffsetDateTime? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -214,8 +216,8 @@ constructor( this.eventIds(eventSearchParams.eventIds) this.timeframeEnd = eventSearchParams.timeframeEnd this.timeframeStart = eventSearchParams.timeframeStart - additionalQueryParams(eventSearchParams.additionalQueryParams) additionalHeaders(eventSearchParams.additionalHeaders) + additionalQueryParams(eventSearchParams.additionalQueryParams) additionalBodyProperties(eventSearchParams.additionalBodyProperties) } @@ -250,45 +252,79 @@ constructor( this.timeframeStart = timeframeStart } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -309,8 +345,14 @@ constructor( checkNotNull(eventIds) { "`eventIds` is required but was not set" }.toImmutable(), timeframeEnd, timeframeStart, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt index 56b8b3817..c01a7a2e0 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -23,8 +25,8 @@ constructor( private val timestamp: OffsetDateTime, private val customerId: String?, private val externalCustomerId: String?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -52,10 +54,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> eventId @@ -204,10 +206,10 @@ constructor( "EventUpdateBody{eventName=$eventName, properties=$properties, timestamp=$timestamp, customerId=$customerId, externalCustomerId=$externalCustomerId, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -215,15 +217,15 @@ constructor( return true } - return /* spotless:off */ other is EventUpdateParams && this.eventId == other.eventId && this.eventName == other.eventName && this.properties == other.properties && this.timestamp == other.timestamp && this.customerId == other.customerId && this.externalCustomerId == other.externalCustomerId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is EventUpdateParams && this.eventId == other.eventId && this.eventName == other.eventName && this.properties == other.properties && this.timestamp == other.timestamp && this.customerId == other.customerId && this.externalCustomerId == other.externalCustomerId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(eventId, eventName, properties, timestamp, customerId, externalCustomerId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(eventId, eventName, properties, timestamp, customerId, externalCustomerId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "EventUpdateParams{eventId=$eventId, eventName=$eventName, properties=$properties, timestamp=$timestamp, customerId=$customerId, externalCustomerId=$externalCustomerId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "EventUpdateParams{eventId=$eventId, eventName=$eventName, properties=$properties, timestamp=$timestamp, customerId=$customerId, externalCustomerId=$externalCustomerId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -241,8 +243,8 @@ constructor( private var timestamp: OffsetDateTime? = null private var customerId: String? = null private var externalCustomerId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -253,8 +255,8 @@ constructor( this.timestamp = eventUpdateParams.timestamp this.customerId = eventUpdateParams.customerId this.externalCustomerId = eventUpdateParams.externalCustomerId - additionalQueryParams(eventUpdateParams.additionalQueryParams) additionalHeaders(eventUpdateParams.additionalHeaders) + additionalQueryParams(eventUpdateParams.additionalQueryParams) additionalBodyProperties(eventUpdateParams.additionalBodyProperties) } @@ -284,45 +286,79 @@ constructor( this.externalCustomerId = externalCustomerId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -346,8 +382,14 @@ constructor( checkNotNull(timestamp) { "`timestamp` is required but was not set" }, customerId, externalCustomerId, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt index 9012eb84f..7b621d0d7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -16,8 +18,8 @@ constructor( private val cursor: String?, private val limit: Long?, private val timeframeEnd: OffsetDateTime?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun timeframeStart(): OffsetDateTime = timeframeStart @@ -28,6 +30,8 @@ constructor( fun timeframeEnd(): Optional = Optional.ofNullable(timeframeEnd) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -43,26 +47,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is EventVolumeListParams && this.timeframeStart == other.timeframeStart && this.cursor == other.cursor && this.limit == other.limit && this.timeframeEnd == other.timeframeEnd && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is EventVolumeListParams && this.timeframeStart == other.timeframeStart && this.cursor == other.cursor && this.limit == other.limit && this.timeframeEnd == other.timeframeEnd && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(timeframeStart, cursor, limit, timeframeEnd, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(timeframeStart, cursor, limit, timeframeEnd, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "EventVolumeListParams{timeframeStart=$timeframeStart, cursor=$cursor, limit=$limit, timeframeEnd=$timeframeEnd, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "EventVolumeListParams{timeframeStart=$timeframeStart, cursor=$cursor, limit=$limit, timeframeEnd=$timeframeEnd, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -78,8 +80,8 @@ constructor( private var cursor: String? = null private var limit: Long? = null private var timeframeEnd: OffsetDateTime? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(eventVolumeListParams: EventVolumeListParams) = apply { @@ -87,8 +89,8 @@ constructor( this.cursor = eventVolumeListParams.cursor this.limit = eventVolumeListParams.limit this.timeframeEnd = eventVolumeListParams.timeframeEnd - additionalQueryParams(eventVolumeListParams.additionalQueryParams) additionalHeaders(eventVolumeListParams.additionalHeaders) + additionalQueryParams(eventVolumeListParams.additionalQueryParams) } /** @@ -117,45 +119,79 @@ constructor( */ fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { this.timeframeEnd = timeframeEnd } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): EventVolumeListParams = EventVolumeListParams( @@ -163,8 +199,14 @@ constructor( cursor, limit, timeframeEnd, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt index f138e7f8d..ab43364df 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField @@ -32,8 +34,8 @@ constructor( private val memo: String?, private val metadata: Metadata?, private val willAutoIssue: Boolean?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -74,10 +76,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = InvoiceCreateBody.Builder::class) @NoAutoDetect class InvoiceCreateBody @@ -302,10 +304,10 @@ constructor( "InvoiceCreateBody{currency=$currency, invoiceDate=$invoiceDate, lineItems=$lineItems, netTerms=$netTerms, customerId=$customerId, discount=$discount, externalCustomerId=$externalCustomerId, memo=$memo, metadata=$metadata, willAutoIssue=$willAutoIssue, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -313,15 +315,15 @@ constructor( return true } - return /* spotless:off */ other is InvoiceCreateParams && this.currency == other.currency && this.invoiceDate == other.invoiceDate && this.lineItems == other.lineItems && this.netTerms == other.netTerms && this.customerId == other.customerId && this.discount == other.discount && this.externalCustomerId == other.externalCustomerId && this.memo == other.memo && this.metadata == other.metadata && this.willAutoIssue == other.willAutoIssue && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceCreateParams && this.currency == other.currency && this.invoiceDate == other.invoiceDate && this.lineItems == other.lineItems && this.netTerms == other.netTerms && this.customerId == other.customerId && this.discount == other.discount && this.externalCustomerId == other.externalCustomerId && this.memo == other.memo && this.metadata == other.metadata && this.willAutoIssue == other.willAutoIssue && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(currency, invoiceDate, lineItems, netTerms, customerId, discount, externalCustomerId, memo, metadata, willAutoIssue, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(currency, invoiceDate, lineItems, netTerms, customerId, discount, externalCustomerId, memo, metadata, willAutoIssue, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "InvoiceCreateParams{currency=$currency, invoiceDate=$invoiceDate, lineItems=$lineItems, netTerms=$netTerms, customerId=$customerId, discount=$discount, externalCustomerId=$externalCustomerId, memo=$memo, metadata=$metadata, willAutoIssue=$willAutoIssue, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "InvoiceCreateParams{currency=$currency, invoiceDate=$invoiceDate, lineItems=$lineItems, netTerms=$netTerms, customerId=$customerId, discount=$discount, externalCustomerId=$externalCustomerId, memo=$memo, metadata=$metadata, willAutoIssue=$willAutoIssue, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -343,8 +345,8 @@ constructor( private var memo: String? = null private var metadata: Metadata? = null private var willAutoIssue: Boolean? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -359,8 +361,8 @@ constructor( this.memo = invoiceCreateParams.memo this.metadata = invoiceCreateParams.metadata this.willAutoIssue = invoiceCreateParams.willAutoIssue - additionalQueryParams(invoiceCreateParams.additionalQueryParams) additionalHeaders(invoiceCreateParams.additionalHeaders) + additionalQueryParams(invoiceCreateParams.additionalQueryParams) additionalBodyProperties(invoiceCreateParams.additionalBodyProperties) } @@ -442,45 +444,79 @@ constructor( */ fun willAutoIssue(willAutoIssue: Boolean) = apply { this.willAutoIssue = willAutoIssue } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -508,8 +544,14 @@ constructor( memo, metadata, willAutoIssue, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchParams.kt index 642d821df..a4da88b1d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class InvoiceFetchParams constructor( private val invoiceId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun invoiceId(): String = invoiceId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> invoiceId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is InvoiceFetchParams && this.invoiceId == other.invoiceId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is InvoiceFetchParams && this.invoiceId == other.invoiceId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(invoiceId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(invoiceId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "InvoiceFetchParams{invoiceId=$invoiceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "InvoiceFetchParams{invoiceId=$invoiceId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,63 +59,103 @@ constructor( class Builder { private var invoiceId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(invoiceFetchParams: InvoiceFetchParams) = apply { this.invoiceId = invoiceFetchParams.invoiceId - additionalQueryParams(invoiceFetchParams.additionalQueryParams) additionalHeaders(invoiceFetchParams.additionalHeaders) + additionalQueryParams(invoiceFetchParams.additionalQueryParams) } fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): InvoiceFetchParams = InvoiceFetchParams( checkNotNull(invoiceId) { "`invoiceId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingParams.kt index f8f652830..3c5a0ac23 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,12 +12,14 @@ import java.util.Objects class InvoiceFetchUpcomingParams constructor( private val subscriptionId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun subscriptionId(): String = subscriptionId + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -24,26 +28,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is InvoiceFetchUpcomingParams && this.subscriptionId == other.subscriptionId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is InvoiceFetchUpcomingParams && this.subscriptionId == other.subscriptionId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "InvoiceFetchUpcomingParams{subscriptionId=$subscriptionId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "InvoiceFetchUpcomingParams{subscriptionId=$subscriptionId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -56,63 +58,103 @@ constructor( class Builder { private var subscriptionId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(invoiceFetchUpcomingParams: InvoiceFetchUpcomingParams) = apply { this.subscriptionId = invoiceFetchUpcomingParams.subscriptionId - additionalQueryParams(invoiceFetchUpcomingParams.additionalQueryParams) additionalHeaders(invoiceFetchUpcomingParams.additionalHeaders) + additionalQueryParams(invoiceFetchUpcomingParams.additionalQueryParams) } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): InvoiceFetchUpcomingParams = InvoiceFetchUpcomingParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt index 15b7e4594..92070983d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -18,8 +20,8 @@ class InvoiceIssueParams constructor( private val invoiceId: String, private val synchronous: Boolean?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -32,10 +34,10 @@ constructor( return InvoiceIssueBody(synchronous, additionalBodyProperties) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> invoiceId @@ -130,10 +132,10 @@ constructor( "InvoiceIssueBody{synchronous=$synchronous, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -141,15 +143,15 @@ constructor( return true } - return /* spotless:off */ other is InvoiceIssueParams && this.invoiceId == other.invoiceId && this.synchronous == other.synchronous && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceIssueParams && this.invoiceId == other.invoiceId && this.synchronous == other.synchronous && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(invoiceId, synchronous, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(invoiceId, synchronous, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "InvoiceIssueParams{invoiceId=$invoiceId, synchronous=$synchronous, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "InvoiceIssueParams{invoiceId=$invoiceId, synchronous=$synchronous, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -163,16 +165,16 @@ constructor( private var invoiceId: String? = null private var synchronous: Boolean? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(invoiceIssueParams: InvoiceIssueParams) = apply { this.invoiceId = invoiceIssueParams.invoiceId this.synchronous = invoiceIssueParams.synchronous - additionalQueryParams(invoiceIssueParams.additionalQueryParams) additionalHeaders(invoiceIssueParams.additionalHeaders) + additionalQueryParams(invoiceIssueParams.additionalQueryParams) additionalBodyProperties(invoiceIssueParams.additionalBodyProperties) } @@ -186,45 +188,79 @@ constructor( */ fun synchronous(synchronous: Boolean) = apply { this.synchronous = synchronous } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -244,8 +280,14 @@ constructor( InvoiceIssueParams( checkNotNull(invoiceId) { "`invoiceId` is required but was not set" }, synchronous, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt index 6a1d96b83..0b74dd35a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -22,8 +24,8 @@ constructor( private val name: String, private val quantity: Double, private val startDate: LocalDate, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -52,10 +54,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = InvoiceLineItemCreateBody.Builder::class) @NoAutoDetect class InvoiceLineItemCreateBody @@ -194,10 +196,10 @@ constructor( "InvoiceLineItemCreateBody{amount=$amount, endDate=$endDate, invoiceId=$invoiceId, name=$name, quantity=$quantity, startDate=$startDate, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -205,15 +207,15 @@ constructor( return true } - return /* spotless:off */ other is InvoiceLineItemCreateParams && this.amount == other.amount && this.endDate == other.endDate && this.invoiceId == other.invoiceId && this.name == other.name && this.quantity == other.quantity && this.startDate == other.startDate && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceLineItemCreateParams && this.amount == other.amount && this.endDate == other.endDate && this.invoiceId == other.invoiceId && this.name == other.name && this.quantity == other.quantity && this.startDate == other.startDate && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(amount, endDate, invoiceId, name, quantity, startDate, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(amount, endDate, invoiceId, name, quantity, startDate, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "InvoiceLineItemCreateParams{amount=$amount, endDate=$endDate, invoiceId=$invoiceId, name=$name, quantity=$quantity, startDate=$startDate, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "InvoiceLineItemCreateParams{amount=$amount, endDate=$endDate, invoiceId=$invoiceId, name=$name, quantity=$quantity, startDate=$startDate, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -231,8 +233,8 @@ constructor( private var name: String? = null private var quantity: Double? = null private var startDate: LocalDate? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -243,8 +245,8 @@ constructor( this.name = invoiceLineItemCreateParams.name this.quantity = invoiceLineItemCreateParams.quantity this.startDate = invoiceLineItemCreateParams.startDate - additionalQueryParams(invoiceLineItemCreateParams.additionalQueryParams) additionalHeaders(invoiceLineItemCreateParams.additionalHeaders) + additionalQueryParams(invoiceLineItemCreateParams.additionalQueryParams) additionalBodyProperties(invoiceLineItemCreateParams.additionalBodyProperties) } @@ -269,45 +271,79 @@ constructor( /** A date string to specify the line item's start date in the customer's timezone. */ fun startDate(startDate: LocalDate) = apply { this.startDate = startDate } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -331,8 +367,14 @@ constructor( checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(quantity) { "`quantity` is required but was not set" }, checkNotNull(startDate) { "`startDate` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt index 13255f150..7ad55f76d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt @@ -3,6 +3,8 @@ package com.withorb.api.models import com.fasterxml.jackson.annotation.JsonCreator +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.JsonValue @@ -37,8 +39,8 @@ constructor( private val limit: Long?, private val status: List?, private val subscriptionId: String?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun amount(): Optional = Optional.ofNullable(amount) @@ -79,6 +81,8 @@ constructor( fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -125,26 +129,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is InvoiceListParams && this.amount == other.amount && this.amountGt == other.amountGt && this.amountLt == other.amountLt && this.cursor == other.cursor && this.customerId == other.customerId && this.dateType == other.dateType && this.dueDate == other.dueDate && this.dueDateWindow == other.dueDateWindow && this.dueDateGt == other.dueDateGt && this.dueDateLt == other.dueDateLt && this.externalCustomerId == other.externalCustomerId && this.invoiceDateGt == other.invoiceDateGt && this.invoiceDateGte == other.invoiceDateGte && this.invoiceDateLt == other.invoiceDateLt && this.invoiceDateLte == other.invoiceDateLte && this.isRecurring == other.isRecurring && this.limit == other.limit && this.status == other.status && this.subscriptionId == other.subscriptionId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is InvoiceListParams && this.amount == other.amount && this.amountGt == other.amountGt && this.amountLt == other.amountLt && this.cursor == other.cursor && this.customerId == other.customerId && this.dateType == other.dateType && this.dueDate == other.dueDate && this.dueDateWindow == other.dueDateWindow && this.dueDateGt == other.dueDateGt && this.dueDateLt == other.dueDateLt && this.externalCustomerId == other.externalCustomerId && this.invoiceDateGt == other.invoiceDateGt && this.invoiceDateGte == other.invoiceDateGte && this.invoiceDateLt == other.invoiceDateLt && this.invoiceDateLte == other.invoiceDateLte && this.isRecurring == other.isRecurring && this.limit == other.limit && this.status == other.status && this.subscriptionId == other.subscriptionId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(amount, amountGt, amountLt, cursor, customerId, dateType, dueDate, dueDateWindow, dueDateGt, dueDateLt, externalCustomerId, invoiceDateGt, invoiceDateGte, invoiceDateLt, invoiceDateLte, isRecurring, limit, status, subscriptionId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(amount, amountGt, amountLt, cursor, customerId, dateType, dueDate, dueDateWindow, dueDateGt, dueDateLt, externalCustomerId, invoiceDateGt, invoiceDateGte, invoiceDateLt, invoiceDateLte, isRecurring, limit, status, subscriptionId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "InvoiceListParams{amount=$amount, amountGt=$amountGt, amountLt=$amountLt, cursor=$cursor, customerId=$customerId, dateType=$dateType, dueDate=$dueDate, dueDateWindow=$dueDateWindow, dueDateGt=$dueDateGt, dueDateLt=$dueDateLt, externalCustomerId=$externalCustomerId, invoiceDateGt=$invoiceDateGt, invoiceDateGte=$invoiceDateGte, invoiceDateLt=$invoiceDateLt, invoiceDateLte=$invoiceDateLte, isRecurring=$isRecurring, limit=$limit, status=$status, subscriptionId=$subscriptionId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "InvoiceListParams{amount=$amount, amountGt=$amountGt, amountLt=$amountLt, cursor=$cursor, customerId=$customerId, dateType=$dateType, dueDate=$dueDate, dueDateWindow=$dueDateWindow, dueDateGt=$dueDateGt, dueDateLt=$dueDateLt, externalCustomerId=$externalCustomerId, invoiceDateGt=$invoiceDateGt, invoiceDateGte=$invoiceDateGte, invoiceDateLt=$invoiceDateLt, invoiceDateLte=$invoiceDateLte, isRecurring=$isRecurring, limit=$limit, status=$status, subscriptionId=$subscriptionId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -175,8 +177,8 @@ constructor( private var limit: Long? = null private var status: MutableList = mutableListOf() private var subscriptionId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(invoiceListParams: InvoiceListParams) = apply { @@ -199,8 +201,8 @@ constructor( this.limit = invoiceListParams.limit this.status(invoiceListParams.status ?: listOf()) this.subscriptionId = invoiceListParams.subscriptionId - additionalQueryParams(invoiceListParams.additionalQueryParams) additionalHeaders(invoiceListParams.additionalHeaders) + additionalQueryParams(invoiceListParams.additionalQueryParams) } fun amount(amount: String) = apply { this.amount = amount } @@ -261,45 +263,79 @@ constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): InvoiceListParams = InvoiceListParams( @@ -322,8 +358,14 @@ constructor( limit, if (status.size == 0) null else status.toImmutable(), subscriptionId, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt index 5e4c0e07f..8f8826f2d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -21,8 +23,8 @@ constructor( private val paymentReceivedDate: LocalDate, private val externalId: String?, private val notes: String?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -44,10 +46,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> invoiceId @@ -160,10 +162,10 @@ constructor( "InvoiceMarkPaidBody{paymentReceivedDate=$paymentReceivedDate, externalId=$externalId, notes=$notes, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -171,15 +173,15 @@ constructor( return true } - return /* spotless:off */ other is InvoiceMarkPaidParams && this.invoiceId == other.invoiceId && this.paymentReceivedDate == other.paymentReceivedDate && this.externalId == other.externalId && this.notes == other.notes && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceMarkPaidParams && this.invoiceId == other.invoiceId && this.paymentReceivedDate == other.paymentReceivedDate && this.externalId == other.externalId && this.notes == other.notes && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(invoiceId, paymentReceivedDate, externalId, notes, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(invoiceId, paymentReceivedDate, externalId, notes, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "InvoiceMarkPaidParams{invoiceId=$invoiceId, paymentReceivedDate=$paymentReceivedDate, externalId=$externalId, notes=$notes, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "InvoiceMarkPaidParams{invoiceId=$invoiceId, paymentReceivedDate=$paymentReceivedDate, externalId=$externalId, notes=$notes, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -195,8 +197,8 @@ constructor( private var paymentReceivedDate: LocalDate? = null private var externalId: String? = null private var notes: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -205,8 +207,8 @@ constructor( this.paymentReceivedDate = invoiceMarkPaidParams.paymentReceivedDate this.externalId = invoiceMarkPaidParams.externalId this.notes = invoiceMarkPaidParams.notes - additionalQueryParams(invoiceMarkPaidParams.additionalQueryParams) additionalHeaders(invoiceMarkPaidParams.additionalHeaders) + additionalQueryParams(invoiceMarkPaidParams.additionalQueryParams) additionalBodyProperties(invoiceMarkPaidParams.additionalBodyProperties) } @@ -223,45 +225,79 @@ constructor( /** An optional note to associate with the payment. */ fun notes(notes: String) = apply { this.notes = notes } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -285,8 +321,14 @@ constructor( }, externalId, notes, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt index b563fe157..c20137cf9 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -18,8 +20,8 @@ class InvoiceUpdateParams constructor( private val invoiceId: String, private val metadata: Metadata?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -32,10 +34,10 @@ constructor( return InvoiceUpdateBody(metadata, additionalBodyProperties) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> invoiceId @@ -127,10 +129,10 @@ constructor( "InvoiceUpdateBody{metadata=$metadata, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -138,15 +140,15 @@ constructor( return true } - return /* spotless:off */ other is InvoiceUpdateParams && this.invoiceId == other.invoiceId && this.metadata == other.metadata && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceUpdateParams && this.invoiceId == other.invoiceId && this.metadata == other.metadata && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(invoiceId, metadata, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(invoiceId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "InvoiceUpdateParams{invoiceId=$invoiceId, metadata=$metadata, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "InvoiceUpdateParams{invoiceId=$invoiceId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -160,16 +162,16 @@ constructor( private var invoiceId: String? = null private var metadata: Metadata? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(invoiceUpdateParams: InvoiceUpdateParams) = apply { this.invoiceId = invoiceUpdateParams.invoiceId this.metadata = invoiceUpdateParams.metadata - additionalQueryParams(invoiceUpdateParams.additionalQueryParams) additionalHeaders(invoiceUpdateParams.additionalHeaders) + additionalQueryParams(invoiceUpdateParams.additionalQueryParams) additionalBodyProperties(invoiceUpdateParams.additionalBodyProperties) } @@ -182,45 +184,79 @@ constructor( */ fun metadata(metadata: Metadata) = apply { this.metadata = metadata } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -240,8 +276,14 @@ constructor( InvoiceUpdateParams( checkNotNull(invoiceId) { "`invoiceId` is required but was not set" }, metadata, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt index 57d336cfd..911206e45 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable @@ -12,8 +14,8 @@ import java.util.Optional class InvoiceVoidInvoiceParams constructor( private val invoiceId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -24,10 +26,10 @@ constructor( return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> invoiceId @@ -35,10 +37,10 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -46,15 +48,15 @@ constructor( return true } - return /* spotless:off */ other is InvoiceVoidInvoiceParams && this.invoiceId == other.invoiceId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceVoidInvoiceParams && this.invoiceId == other.invoiceId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(invoiceId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(invoiceId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "InvoiceVoidInvoiceParams{invoiceId=$invoiceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "InvoiceVoidInvoiceParams{invoiceId=$invoiceId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -67,59 +69,93 @@ constructor( class Builder { private var invoiceId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(invoiceVoidInvoiceParams: InvoiceVoidInvoiceParams) = apply { this.invoiceId = invoiceVoidInvoiceParams.invoiceId - additionalQueryParams(invoiceVoidInvoiceParams.additionalQueryParams) additionalHeaders(invoiceVoidInvoiceParams.additionalHeaders) + additionalQueryParams(invoiceVoidInvoiceParams.additionalQueryParams) additionalBodyProperties(invoiceVoidInvoiceParams.additionalBodyProperties) } fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -138,8 +174,14 @@ constructor( fun build(): InvoiceVoidInvoiceParams = InvoiceVoidInvoiceParams( checkNotNull(invoiceId) { "`invoiceId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt index 6bd96c6a1..ae61fa2f5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -16,8 +18,8 @@ import java.util.Objects class ItemCreateParams constructor( private val name: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -28,10 +30,10 @@ constructor( return ItemCreateBody(name, additionalBodyProperties) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = ItemCreateBody.Builder::class) @NoAutoDetect class ItemCreateBody @@ -110,10 +112,10 @@ constructor( "ItemCreateBody{name=$name, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -121,15 +123,15 @@ constructor( return true } - return /* spotless:off */ other is ItemCreateParams && this.name == other.name && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is ItemCreateParams && this.name == other.name && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(name, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(name, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "ItemCreateParams{name=$name, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "ItemCreateParams{name=$name, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -142,60 +144,94 @@ constructor( class Builder { private var name: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(itemCreateParams: ItemCreateParams) = apply { this.name = itemCreateParams.name - additionalQueryParams(itemCreateParams.additionalQueryParams) additionalHeaders(itemCreateParams.additionalHeaders) + additionalQueryParams(itemCreateParams.additionalQueryParams) additionalBodyProperties(itemCreateParams.additionalBodyProperties) } /** The name of the item. */ fun name(name: String) = apply { this.name = name } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -214,8 +250,14 @@ constructor( fun build(): ItemCreateParams = ItemCreateParams( checkNotNull(name) { "`name` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemFetchParams.kt index da921feaa..7f6aa5b10 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemFetchParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class ItemFetchParams constructor( private val itemId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun itemId(): String = itemId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> itemId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is ItemFetchParams && this.itemId == other.itemId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is ItemFetchParams && this.itemId == other.itemId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(itemId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(itemId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "ItemFetchParams{itemId=$itemId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "ItemFetchParams{itemId=$itemId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,63 +59,103 @@ constructor( class Builder { private var itemId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(itemFetchParams: ItemFetchParams) = apply { this.itemId = itemFetchParams.itemId - additionalQueryParams(itemFetchParams.additionalQueryParams) additionalHeaders(itemFetchParams.additionalHeaders) + additionalQueryParams(itemFetchParams.additionalQueryParams) } fun itemId(itemId: String) = apply { this.itemId = itemId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): ItemFetchParams = ItemFetchParams( checkNotNull(itemId) { "`itemId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt index 36bd81481..352e1cc4c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -12,14 +14,16 @@ class ItemListParams constructor( private val cursor: String?, private val limit: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun cursor(): Optional = Optional.ofNullable(cursor) fun limit(): Optional = Optional.ofNullable(limit) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -29,26 +33,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is ItemListParams && this.cursor == other.cursor && this.limit == other.limit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is ItemListParams && this.cursor == other.cursor && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(cursor, limit, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(cursor, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "ItemListParams{cursor=$cursor, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "ItemListParams{cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -62,15 +64,15 @@ constructor( private var cursor: String? = null private var limit: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(itemListParams: ItemListParams) = apply { this.cursor = itemListParams.cursor this.limit = itemListParams.limit - additionalQueryParams(itemListParams.additionalQueryParams) additionalHeaders(itemListParams.additionalHeaders) + additionalQueryParams(itemListParams.additionalQueryParams) } /** @@ -82,52 +84,92 @@ constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long) = apply { this.limit = limit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): ItemListParams = ItemListParams( cursor, limit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt index 1bc4e0f0d..621eec14b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField @@ -23,8 +25,8 @@ constructor( private val itemId: String, private val externalConnections: List?, private val name: String?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -44,10 +46,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> itemId @@ -148,10 +150,10 @@ constructor( "ItemUpdateBody{externalConnections=$externalConnections, name=$name, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -159,15 +161,15 @@ constructor( return true } - return /* spotless:off */ other is ItemUpdateParams && this.itemId == other.itemId && this.externalConnections == other.externalConnections && this.name == other.name && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is ItemUpdateParams && this.itemId == other.itemId && this.externalConnections == other.externalConnections && this.name == other.name && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(itemId, externalConnections, name, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(itemId, externalConnections, name, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "ItemUpdateParams{itemId=$itemId, externalConnections=$externalConnections, name=$name, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "ItemUpdateParams{itemId=$itemId, externalConnections=$externalConnections, name=$name, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -182,8 +184,8 @@ constructor( private var itemId: String? = null private var externalConnections: MutableList = mutableListOf() private var name: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -191,8 +193,8 @@ constructor( this.itemId = itemUpdateParams.itemId this.externalConnections(itemUpdateParams.externalConnections ?: listOf()) this.name = itemUpdateParams.name - additionalQueryParams(itemUpdateParams.additionalQueryParams) additionalHeaders(itemUpdateParams.additionalHeaders) + additionalQueryParams(itemUpdateParams.additionalQueryParams) additionalBodyProperties(itemUpdateParams.additionalBodyProperties) } @@ -209,45 +211,79 @@ constructor( fun name(name: String) = apply { this.name = name } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -268,8 +304,14 @@ constructor( checkNotNull(itemId) { "`itemId` is required but was not set" }, if (externalConnections.size == 0) null else externalConnections.toImmutable(), name, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt index 736982109..7aedb7aad 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -21,8 +23,8 @@ constructor( private val name: String, private val sql: String, private val metadata: Metadata?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -48,10 +50,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = MetricCreateBody.Builder::class) @NoAutoDetect class MetricCreateBody @@ -180,10 +182,10 @@ constructor( "MetricCreateBody{description=$description, itemId=$itemId, name=$name, sql=$sql, metadata=$metadata, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -191,15 +193,15 @@ constructor( return true } - return /* spotless:off */ other is MetricCreateParams && this.description == other.description && this.itemId == other.itemId && this.name == other.name && this.sql == other.sql && this.metadata == other.metadata && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is MetricCreateParams && this.description == other.description && this.itemId == other.itemId && this.name == other.name && this.sql == other.sql && this.metadata == other.metadata && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(description, itemId, name, sql, metadata, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(description, itemId, name, sql, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "MetricCreateParams{description=$description, itemId=$itemId, name=$name, sql=$sql, metadata=$metadata, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "MetricCreateParams{description=$description, itemId=$itemId, name=$name, sql=$sql, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -216,8 +218,8 @@ constructor( private var name: String? = null private var sql: String? = null private var metadata: Metadata? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -227,8 +229,8 @@ constructor( this.name = metricCreateParams.name this.sql = metricCreateParams.sql this.metadata = metricCreateParams.metadata - additionalQueryParams(metricCreateParams.additionalQueryParams) additionalHeaders(metricCreateParams.additionalHeaders) + additionalQueryParams(metricCreateParams.additionalQueryParams) additionalBodyProperties(metricCreateParams.additionalBodyProperties) } @@ -251,45 +253,79 @@ constructor( */ fun metadata(metadata: Metadata) = apply { this.metadata = metadata } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -312,8 +348,14 @@ constructor( checkNotNull(name) { "`name` is required but was not set" }, checkNotNull(sql) { "`sql` is required but was not set" }, metadata, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricFetchParams.kt index 05e0222cc..6c8a9070e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricFetchParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class MetricFetchParams constructor( private val metricId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun metricId(): String = metricId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> metricId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is MetricFetchParams && this.metricId == other.metricId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is MetricFetchParams && this.metricId == other.metricId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(metricId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(metricId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "MetricFetchParams{metricId=$metricId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "MetricFetchParams{metricId=$metricId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,63 +59,103 @@ constructor( class Builder { private var metricId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(metricFetchParams: MetricFetchParams) = apply { this.metricId = metricFetchParams.metricId - additionalQueryParams(metricFetchParams.additionalQueryParams) additionalHeaders(metricFetchParams.additionalHeaders) + additionalQueryParams(metricFetchParams.additionalQueryParams) } fun metricId(metricId: String) = apply { this.metricId = metricId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): MetricFetchParams = MetricFetchParams( checkNotNull(metricId) { "`metricId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt index 5aa525a54..a2fbc0cfc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -18,8 +20,8 @@ constructor( private val createdAtLte: OffsetDateTime?, private val cursor: String?, private val limit: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun createdAtGt(): Optional = Optional.ofNullable(createdAtGt) @@ -34,6 +36,8 @@ constructor( fun limit(): Optional = Optional.ofNullable(limit) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -55,26 +59,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is MetricListParams && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.cursor == other.cursor && this.limit == other.limit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is MetricListParams && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.cursor == other.cursor && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(createdAtGt, createdAtGte, createdAtLt, createdAtLte, cursor, limit, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(createdAtGt, createdAtGte, createdAtLt, createdAtLte, cursor, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "MetricListParams{createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, cursor=$cursor, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "MetricListParams{createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -92,8 +94,8 @@ constructor( private var createdAtLte: OffsetDateTime? = null private var cursor: String? = null private var limit: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(metricListParams: MetricListParams) = apply { @@ -103,8 +105,8 @@ constructor( this.createdAtLte = metricListParams.createdAtLte this.cursor = metricListParams.cursor this.limit = metricListParams.limit - additionalQueryParams(metricListParams.additionalQueryParams) additionalHeaders(metricListParams.additionalHeaders) + additionalQueryParams(metricListParams.additionalQueryParams) } fun createdAtGt(createdAtGt: OffsetDateTime) = apply { this.createdAtGt = createdAtGt } @@ -124,45 +126,79 @@ constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long) = apply { this.limit = limit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): MetricListParams = MetricListParams( @@ -172,8 +208,14 @@ constructor( createdAtLte, cursor, limit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt index bbc15f9ae..aeccb04ba 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -18,8 +20,8 @@ class MetricUpdateParams constructor( private val metricId: String, private val metadata: Metadata?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -32,10 +34,10 @@ constructor( return MetricUpdateBody(metadata, additionalBodyProperties) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> metricId @@ -127,10 +129,10 @@ constructor( "MetricUpdateBody{metadata=$metadata, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -138,15 +140,15 @@ constructor( return true } - return /* spotless:off */ other is MetricUpdateParams && this.metricId == other.metricId && this.metadata == other.metadata && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is MetricUpdateParams && this.metricId == other.metricId && this.metadata == other.metadata && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(metricId, metadata, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(metricId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "MetricUpdateParams{metricId=$metricId, metadata=$metadata, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "MetricUpdateParams{metricId=$metricId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -160,16 +162,16 @@ constructor( private var metricId: String? = null private var metadata: Metadata? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(metricUpdateParams: MetricUpdateParams) = apply { this.metricId = metricUpdateParams.metricId this.metadata = metricUpdateParams.metadata - additionalQueryParams(metricUpdateParams.additionalQueryParams) additionalHeaders(metricUpdateParams.additionalHeaders) + additionalQueryParams(metricUpdateParams.additionalQueryParams) additionalBodyProperties(metricUpdateParams.additionalBodyProperties) } @@ -182,45 +184,79 @@ constructor( */ fun metadata(metadata: Metadata) = apply { this.metadata = metadata } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -240,8 +276,14 @@ constructor( MetricUpdateParams( checkNotNull(metricId) { "`metricId` is required but was not set" }, metadata, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } 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 d1bbba780..7dd876a4a 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 @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer import com.withorb.api.core.Enum @@ -39,8 +41,8 @@ constructor( private val metadata: Metadata?, private val netTerms: Long?, private val status: Status?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -75,10 +77,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = PlanCreateBody.Builder::class) @NoAutoDetect class PlanCreateBody @@ -258,10 +260,10 @@ constructor( "PlanCreateBody{currency=$currency, name=$name, prices=$prices, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, metadata=$metadata, netTerms=$netTerms, status=$status, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -269,15 +271,15 @@ constructor( return true } - return /* spotless:off */ other is PlanCreateParams && this.currency == other.currency && this.name == other.name && this.prices == other.prices && this.defaultInvoiceMemo == other.defaultInvoiceMemo && this.externalPlanId == other.externalPlanId && this.metadata == other.metadata && this.netTerms == other.netTerms && this.status == other.status && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PlanCreateParams && this.currency == other.currency && this.name == other.name && this.prices == other.prices && this.defaultInvoiceMemo == other.defaultInvoiceMemo && this.externalPlanId == other.externalPlanId && this.metadata == other.metadata && this.netTerms == other.netTerms && this.status == other.status && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(currency, name, prices, defaultInvoiceMemo, externalPlanId, metadata, netTerms, status, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(currency, name, prices, defaultInvoiceMemo, externalPlanId, metadata, netTerms, status, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "PlanCreateParams{currency=$currency, name=$name, prices=$prices, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, metadata=$metadata, netTerms=$netTerms, status=$status, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "PlanCreateParams{currency=$currency, name=$name, prices=$prices, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, metadata=$metadata, netTerms=$netTerms, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -297,8 +299,8 @@ constructor( private var metadata: Metadata? = null private var netTerms: Long? = null private var status: Status? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -311,8 +313,8 @@ constructor( this.metadata = planCreateParams.metadata this.netTerms = planCreateParams.netTerms this.status = planCreateParams.status - additionalQueryParams(planCreateParams.additionalQueryParams) additionalHeaders(planCreateParams.additionalHeaders) + additionalQueryParams(planCreateParams.additionalQueryParams) additionalBodyProperties(planCreateParams.additionalBodyProperties) } @@ -362,45 +364,79 @@ constructor( */ fun status(status: Status) = apply { this.status = status } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -426,8 +462,14 @@ constructor( metadata, netTerms, status, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdFetchParams.kt index 327e00f16..1329267b1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdFetchParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class PlanExternalPlanIdFetchParams constructor( private val externalPlanId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun externalPlanId(): String = externalPlanId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> externalPlanId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is PlanExternalPlanIdFetchParams && this.externalPlanId == other.externalPlanId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is PlanExternalPlanIdFetchParams && this.externalPlanId == other.externalPlanId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(externalPlanId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(externalPlanId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "PlanExternalPlanIdFetchParams{externalPlanId=$externalPlanId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "PlanExternalPlanIdFetchParams{externalPlanId=$externalPlanId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,63 +59,103 @@ constructor( class Builder { private var externalPlanId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(planExternalPlanIdFetchParams: PlanExternalPlanIdFetchParams) = apply { this.externalPlanId = planExternalPlanIdFetchParams.externalPlanId - additionalQueryParams(planExternalPlanIdFetchParams.additionalQueryParams) additionalHeaders(planExternalPlanIdFetchParams.additionalHeaders) + additionalQueryParams(planExternalPlanIdFetchParams.additionalQueryParams) } fun externalPlanId(externalPlanId: String) = apply { this.externalPlanId = externalPlanId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): PlanExternalPlanIdFetchParams = PlanExternalPlanIdFetchParams( checkNotNull(externalPlanId) { "`externalPlanId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt index baf8aaaf6..24db4be10 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -19,8 +21,8 @@ constructor( private val otherExternalPlanId: String, private val externalPlanId: String?, private val metadata: Metadata?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -39,10 +41,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> otherExternalPlanId @@ -158,10 +160,10 @@ constructor( "PlanExternalPlanIdUpdateBody{externalPlanId=$externalPlanId, metadata=$metadata, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -169,15 +171,15 @@ constructor( return true } - return /* spotless:off */ other is PlanExternalPlanIdUpdateParams && this.otherExternalPlanId == other.otherExternalPlanId && this.externalPlanId == other.externalPlanId && this.metadata == other.metadata && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PlanExternalPlanIdUpdateParams && this.otherExternalPlanId == other.otherExternalPlanId && this.externalPlanId == other.externalPlanId && this.metadata == other.metadata && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(otherExternalPlanId, externalPlanId, metadata, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(otherExternalPlanId, externalPlanId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "PlanExternalPlanIdUpdateParams{otherExternalPlanId=$otherExternalPlanId, externalPlanId=$externalPlanId, metadata=$metadata, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "PlanExternalPlanIdUpdateParams{otherExternalPlanId=$otherExternalPlanId, externalPlanId=$externalPlanId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -192,8 +194,8 @@ constructor( private var otherExternalPlanId: String? = null private var externalPlanId: String? = null private var metadata: Metadata? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -201,8 +203,8 @@ constructor( this.otherExternalPlanId = planExternalPlanIdUpdateParams.otherExternalPlanId this.externalPlanId = planExternalPlanIdUpdateParams.externalPlanId this.metadata = planExternalPlanIdUpdateParams.metadata - additionalQueryParams(planExternalPlanIdUpdateParams.additionalQueryParams) additionalHeaders(planExternalPlanIdUpdateParams.additionalHeaders) + additionalQueryParams(planExternalPlanIdUpdateParams.additionalQueryParams) additionalBodyProperties(planExternalPlanIdUpdateParams.additionalBodyProperties) } @@ -224,45 +226,79 @@ constructor( */ fun metadata(metadata: Metadata) = apply { this.metadata = metadata } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -285,8 +321,14 @@ constructor( }, externalPlanId, metadata, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanFetchParams.kt index 764e01217..bb732b962 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanFetchParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class PlanFetchParams constructor( private val planId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun planId(): String = planId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> planId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is PlanFetchParams && this.planId == other.planId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is PlanFetchParams && this.planId == other.planId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(planId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(planId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "PlanFetchParams{planId=$planId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "PlanFetchParams{planId=$planId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,63 +59,103 @@ constructor( class Builder { private var planId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(planFetchParams: PlanFetchParams) = apply { this.planId = planFetchParams.planId - additionalQueryParams(planFetchParams.additionalQueryParams) additionalHeaders(planFetchParams.additionalHeaders) + additionalQueryParams(planFetchParams.additionalQueryParams) } fun planId(planId: String) = apply { this.planId = planId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): PlanFetchParams = PlanFetchParams( checkNotNull(planId) { "`planId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt index 535081fc8..51925aca2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt @@ -3,6 +3,8 @@ package com.withorb.api.models import com.fasterxml.jackson.annotation.JsonCreator +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.JsonValue @@ -24,8 +26,8 @@ constructor( private val cursor: String?, private val limit: Long?, private val status: Status?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun createdAtGt(): Optional = Optional.ofNullable(createdAtGt) @@ -42,6 +44,8 @@ constructor( fun status(): Optional = Optional.ofNullable(status) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -64,26 +68,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is PlanListParams && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.cursor == other.cursor && this.limit == other.limit && this.status == other.status && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is PlanListParams && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.cursor == other.cursor && this.limit == other.limit && this.status == other.status && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(createdAtGt, createdAtGte, createdAtLt, createdAtLte, cursor, limit, status, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(createdAtGt, createdAtGte, createdAtLt, createdAtLte, cursor, limit, status, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "PlanListParams{createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, cursor=$cursor, limit=$limit, status=$status, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "PlanListParams{createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, cursor=$cursor, limit=$limit, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -102,8 +104,8 @@ constructor( private var cursor: String? = null private var limit: Long? = null private var status: Status? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(planListParams: PlanListParams) = apply { @@ -114,8 +116,8 @@ constructor( this.cursor = planListParams.cursor this.limit = planListParams.limit this.status = planListParams.status - additionalQueryParams(planListParams.additionalQueryParams) additionalHeaders(planListParams.additionalHeaders) + additionalQueryParams(planListParams.additionalQueryParams) } fun createdAtGt(createdAtGt: OffsetDateTime) = apply { this.createdAtGt = createdAtGt } @@ -138,45 +140,79 @@ constructor( /** The plan status to filter to ('active', 'archived', or 'draft'). */ fun status(status: Status) = apply { this.status = status } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): PlanListParams = PlanListParams( @@ -187,8 +223,14 @@ constructor( cursor, limit, status, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt index 0c6a6fd78..f9984828b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -19,8 +21,8 @@ constructor( private val planId: String, private val externalPlanId: String?, private val metadata: Metadata?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -39,10 +41,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> planId @@ -158,10 +160,10 @@ constructor( "PlanUpdateBody{externalPlanId=$externalPlanId, metadata=$metadata, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -169,15 +171,15 @@ constructor( return true } - return /* spotless:off */ other is PlanUpdateParams && this.planId == other.planId && this.externalPlanId == other.externalPlanId && this.metadata == other.metadata && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PlanUpdateParams && this.planId == other.planId && this.externalPlanId == other.externalPlanId && this.metadata == other.metadata && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(planId, externalPlanId, metadata, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(planId, externalPlanId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "PlanUpdateParams{planId=$planId, externalPlanId=$externalPlanId, metadata=$metadata, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "PlanUpdateParams{planId=$planId, externalPlanId=$externalPlanId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -192,8 +194,8 @@ constructor( private var planId: String? = null private var externalPlanId: String? = null private var metadata: Metadata? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -201,8 +203,8 @@ constructor( this.planId = planUpdateParams.planId this.externalPlanId = planUpdateParams.externalPlanId this.metadata = planUpdateParams.metadata - additionalQueryParams(planUpdateParams.additionalQueryParams) additionalHeaders(planUpdateParams.additionalHeaders) + additionalQueryParams(planUpdateParams.additionalQueryParams) additionalBodyProperties(planUpdateParams.additionalBodyProperties) } @@ -222,45 +224,79 @@ constructor( */ fun metadata(metadata: Metadata) = apply { this.metadata = metadata } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -281,8 +317,14 @@ constructor( checkNotNull(planId) { "`planId` is required but was not set" }, externalPlanId, metadata, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt index 34f3712ac..3925dae64 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer import com.withorb.api.core.Enum @@ -55,8 +57,8 @@ constructor( NewFloatingGroupedWithMeteredMinimumPrice?, private val newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice?, private val newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun newFloatingUnitPrice(): Optional = @@ -160,10 +162,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(using = PriceCreateBody.Deserializer::class) @JsonSerialize(using = PriceCreateBody.Serializer::class) class PriceCreateBody @@ -1053,24 +1055,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is PriceCreateParams && this.newFloatingUnitPrice == other.newFloatingUnitPrice && this.newFloatingPackagePrice == other.newFloatingPackagePrice && this.newFloatingMatrixPrice == other.newFloatingMatrixPrice && this.newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && this.newFloatingTieredPrice == other.newFloatingTieredPrice && this.newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && this.newFloatingBpsPrice == other.newFloatingBpsPrice && this.newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && this.newFloatingBulkPrice == other.newFloatingBulkPrice && this.newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && this.newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && this.newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && this.newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && this.newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && this.newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && this.newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && this.newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && this.newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && this.newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && this.newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && this.newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && this.newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && this.newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is PriceCreateParams && this.newFloatingUnitPrice == other.newFloatingUnitPrice && this.newFloatingPackagePrice == other.newFloatingPackagePrice && this.newFloatingMatrixPrice == other.newFloatingMatrixPrice && this.newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && this.newFloatingTieredPrice == other.newFloatingTieredPrice && this.newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && this.newFloatingBpsPrice == other.newFloatingBpsPrice && this.newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && this.newFloatingBulkPrice == other.newFloatingBulkPrice && this.newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && this.newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && this.newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && this.newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && this.newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && this.newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && this.newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && this.newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && this.newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && this.newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && this.newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && this.newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && this.newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && this.newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "PriceCreateParams{newFloatingUnitPrice=$newFloatingUnitPrice, newFloatingPackagePrice=$newFloatingPackagePrice, newFloatingMatrixPrice=$newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice=$newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice=$newFloatingTieredPrice, newFloatingTieredBpsPrice=$newFloatingTieredBpsPrice, newFloatingBpsPrice=$newFloatingBpsPrice, newFloatingBulkBpsPrice=$newFloatingBulkBpsPrice, newFloatingBulkPrice=$newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice=$newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice=$newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice=$newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice=$newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice=$newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice=$newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice=$newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice=$newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice=$newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice=$newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice=$newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice=$newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice=$newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice=$newFloatingBulkWithProrationPrice, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "PriceCreateParams{newFloatingUnitPrice=$newFloatingUnitPrice, newFloatingPackagePrice=$newFloatingPackagePrice, newFloatingMatrixPrice=$newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice=$newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice=$newFloatingTieredPrice, newFloatingTieredBpsPrice=$newFloatingTieredBpsPrice, newFloatingBpsPrice=$newFloatingBpsPrice, newFloatingBulkBpsPrice=$newFloatingBulkBpsPrice, newFloatingBulkPrice=$newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice=$newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice=$newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice=$newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice=$newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice=$newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice=$newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice=$newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice=$newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice=$newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice=$newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice=$newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice=$newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice=$newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice=$newFloatingBulkWithProrationPrice, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -1115,8 +1117,8 @@ constructor( private var newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice? = null private var newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(priceCreateParams: PriceCreateParams) = apply { @@ -1155,8 +1157,8 @@ constructor( priceCreateParams.newFloatingMatrixWithDisplayNamePrice this.newFloatingBulkWithProrationPrice = priceCreateParams.newFloatingBulkWithProrationPrice - additionalQueryParams(priceCreateParams.additionalQueryParams) additionalHeaders(priceCreateParams.additionalHeaders) + additionalQueryParams(priceCreateParams.additionalQueryParams) } fun forNewFloatingUnitPrice(newFloatingUnitPrice: NewFloatingUnitPrice) = apply { @@ -1790,45 +1792,79 @@ constructor( this.newFloatingBulkWithProrationPrice = newFloatingBulkWithProrationPrice } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): PriceCreateParams = PriceCreateParams( @@ -1855,8 +1891,14 @@ constructor( newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt index 47489f4dc..75e77edd7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -24,8 +26,8 @@ constructor( private val externalCustomerId: String?, private val filter: String?, private val groupingKeys: List?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -56,10 +58,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> priceId @@ -224,10 +226,10 @@ constructor( "PriceEvaluateBody{timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, customerId=$customerId, externalCustomerId=$externalCustomerId, filter=$filter, groupingKeys=$groupingKeys, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -235,15 +237,15 @@ constructor( return true } - return /* spotless:off */ other is PriceEvaluateParams && this.priceId == other.priceId && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.customerId == other.customerId && this.externalCustomerId == other.externalCustomerId && this.filter == other.filter && this.groupingKeys == other.groupingKeys && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PriceEvaluateParams && this.priceId == other.priceId && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.customerId == other.customerId && this.externalCustomerId == other.externalCustomerId && this.filter == other.filter && this.groupingKeys == other.groupingKeys && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(priceId, timeframeEnd, timeframeStart, customerId, externalCustomerId, filter, groupingKeys, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(priceId, timeframeEnd, timeframeStart, customerId, externalCustomerId, filter, groupingKeys, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "PriceEvaluateParams{priceId=$priceId, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, customerId=$customerId, externalCustomerId=$externalCustomerId, filter=$filter, groupingKeys=$groupingKeys, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "PriceEvaluateParams{priceId=$priceId, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, customerId=$customerId, externalCustomerId=$externalCustomerId, filter=$filter, groupingKeys=$groupingKeys, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -262,8 +264,8 @@ constructor( private var externalCustomerId: String? = null private var filter: String? = null private var groupingKeys: MutableList = mutableListOf() - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -275,8 +277,8 @@ constructor( this.externalCustomerId = priceEvaluateParams.externalCustomerId this.filter = priceEvaluateParams.filter this.groupingKeys(priceEvaluateParams.groupingKeys ?: listOf()) - additionalQueryParams(priceEvaluateParams.additionalQueryParams) additionalHeaders(priceEvaluateParams.additionalHeaders) + additionalQueryParams(priceEvaluateParams.additionalQueryParams) additionalBodyProperties(priceEvaluateParams.additionalBodyProperties) } @@ -322,45 +324,79 @@ constructor( */ fun addGroupingKey(groupingKey: String) = apply { this.groupingKeys.add(groupingKey) } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -385,8 +421,14 @@ constructor( externalCustomerId, filter, if (groupingKeys.size == 0) null else groupingKeys.toImmutable(), - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdFetchParams.kt index 9c0b208c4..4b50e1548 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdFetchParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class PriceExternalPriceIdFetchParams constructor( private val externalPriceId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun externalPriceId(): String = externalPriceId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> externalPriceId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is PriceExternalPriceIdFetchParams && this.externalPriceId == other.externalPriceId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is PriceExternalPriceIdFetchParams && this.externalPriceId == other.externalPriceId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(externalPriceId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(externalPriceId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "PriceExternalPriceIdFetchParams{externalPriceId=$externalPriceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "PriceExternalPriceIdFetchParams{externalPriceId=$externalPriceId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,66 +59,106 @@ constructor( class Builder { private var externalPriceId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(priceExternalPriceIdFetchParams: PriceExternalPriceIdFetchParams) = apply { this.externalPriceId = priceExternalPriceIdFetchParams.externalPriceId - additionalQueryParams(priceExternalPriceIdFetchParams.additionalQueryParams) additionalHeaders(priceExternalPriceIdFetchParams.additionalHeaders) + additionalQueryParams(priceExternalPriceIdFetchParams.additionalQueryParams) } fun externalPriceId(externalPriceId: String) = apply { this.externalPriceId = externalPriceId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): PriceExternalPriceIdFetchParams = PriceExternalPriceIdFetchParams( checkNotNull(externalPriceId) { "`externalPriceId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt index b441c1e4d..05a1c419e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -18,8 +20,8 @@ class PriceExternalPriceIdUpdateParams constructor( private val externalPriceId: String, private val metadata: Metadata?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -32,10 +34,10 @@ constructor( return PriceExternalPriceIdUpdateBody(metadata, additionalBodyProperties) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> externalPriceId @@ -128,10 +130,10 @@ constructor( "PriceExternalPriceIdUpdateBody{metadata=$metadata, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -139,15 +141,15 @@ constructor( return true } - return /* spotless:off */ other is PriceExternalPriceIdUpdateParams && this.externalPriceId == other.externalPriceId && this.metadata == other.metadata && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PriceExternalPriceIdUpdateParams && this.externalPriceId == other.externalPriceId && this.metadata == other.metadata && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(externalPriceId, metadata, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(externalPriceId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "PriceExternalPriceIdUpdateParams{externalPriceId=$externalPriceId, metadata=$metadata, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "PriceExternalPriceIdUpdateParams{externalPriceId=$externalPriceId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -161,8 +163,8 @@ constructor( private var externalPriceId: String? = null private var metadata: Metadata? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -170,8 +172,8 @@ constructor( apply { this.externalPriceId = priceExternalPriceIdUpdateParams.externalPriceId this.metadata = priceExternalPriceIdUpdateParams.metadata - additionalQueryParams(priceExternalPriceIdUpdateParams.additionalQueryParams) additionalHeaders(priceExternalPriceIdUpdateParams.additionalHeaders) + additionalQueryParams(priceExternalPriceIdUpdateParams.additionalQueryParams) additionalBodyProperties(priceExternalPriceIdUpdateParams.additionalBodyProperties) } @@ -186,45 +188,79 @@ constructor( */ fun metadata(metadata: Metadata) = apply { this.metadata = metadata } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -244,8 +280,14 @@ constructor( PriceExternalPriceIdUpdateParams( checkNotNull(externalPriceId) { "`externalPriceId` is required but was not set" }, metadata, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceFetchParams.kt index aed0e2112..a95a2e111 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceFetchParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class PriceFetchParams constructor( private val priceId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun priceId(): String = priceId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> priceId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is PriceFetchParams && this.priceId == other.priceId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is PriceFetchParams && this.priceId == other.priceId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(priceId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(priceId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "PriceFetchParams{priceId=$priceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "PriceFetchParams{priceId=$priceId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,63 +59,103 @@ constructor( class Builder { private var priceId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(priceFetchParams: PriceFetchParams) = apply { this.priceId = priceFetchParams.priceId - additionalQueryParams(priceFetchParams.additionalQueryParams) additionalHeaders(priceFetchParams.additionalHeaders) + additionalQueryParams(priceFetchParams.additionalQueryParams) } fun priceId(priceId: String) = apply { this.priceId = priceId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): PriceFetchParams = PriceFetchParams( checkNotNull(priceId) { "`priceId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt index 8e9502674..179b401df 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -12,14 +14,16 @@ class PriceListParams constructor( private val cursor: String?, private val limit: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun cursor(): Optional = Optional.ofNullable(cursor) fun limit(): Optional = Optional.ofNullable(limit) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -29,26 +33,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is PriceListParams && this.cursor == other.cursor && this.limit == other.limit && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is PriceListParams && this.cursor == other.cursor && this.limit == other.limit && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(cursor, limit, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(cursor, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "PriceListParams{cursor=$cursor, limit=$limit, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "PriceListParams{cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -62,15 +64,15 @@ constructor( private var cursor: String? = null private var limit: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(priceListParams: PriceListParams) = apply { this.cursor = priceListParams.cursor this.limit = priceListParams.limit - additionalQueryParams(priceListParams.additionalQueryParams) additionalHeaders(priceListParams.additionalHeaders) + additionalQueryParams(priceListParams.additionalQueryParams) } /** @@ -82,52 +84,92 @@ constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long) = apply { this.limit = limit } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): PriceListParams = PriceListParams( cursor, limit, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt index dadfa548c..0f638981a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -18,8 +20,8 @@ class PriceUpdateParams constructor( private val priceId: String, private val metadata: Metadata?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -32,10 +34,10 @@ constructor( return PriceUpdateBody(metadata, additionalBodyProperties) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> priceId @@ -127,10 +129,10 @@ constructor( "PriceUpdateBody{metadata=$metadata, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -138,15 +140,15 @@ constructor( return true } - return /* spotless:off */ other is PriceUpdateParams && this.priceId == other.priceId && this.metadata == other.metadata && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PriceUpdateParams && this.priceId == other.priceId && this.metadata == other.metadata && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(priceId, metadata, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(priceId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "PriceUpdateParams{priceId=$priceId, metadata=$metadata, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "PriceUpdateParams{priceId=$priceId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -160,16 +162,16 @@ constructor( private var priceId: String? = null private var metadata: Metadata? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceUpdateParams: PriceUpdateParams) = apply { this.priceId = priceUpdateParams.priceId this.metadata = priceUpdateParams.metadata - additionalQueryParams(priceUpdateParams.additionalQueryParams) additionalHeaders(priceUpdateParams.additionalHeaders) + additionalQueryParams(priceUpdateParams.additionalQueryParams) additionalBodyProperties(priceUpdateParams.additionalBodyProperties) } @@ -182,45 +184,79 @@ constructor( */ fun metadata(metadata: Metadata) = apply { this.metadata = metadata } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -240,8 +276,14 @@ constructor( PriceUpdateParams( checkNotNull(priceId) { "`priceId` is required but was not set" }, metadata, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt index fe8ac2ab2..9e93e9c5a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField @@ -24,8 +26,8 @@ constructor( private val subscriptionId: String, private val cancelOption: CancelOption, private val cancellationDate: OffsetDateTime?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -44,10 +46,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -156,10 +158,10 @@ constructor( "SubscriptionCancelBody{cancelOption=$cancelOption, cancellationDate=$cancellationDate, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -167,15 +169,15 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionCancelParams && this.subscriptionId == other.subscriptionId && this.cancelOption == other.cancelOption && this.cancellationDate == other.cancellationDate && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionCancelParams && this.subscriptionId == other.subscriptionId && this.cancelOption == other.cancelOption && this.cancellationDate == other.cancellationDate && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, cancelOption, cancellationDate, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, cancelOption, cancellationDate, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "SubscriptionCancelParams{subscriptionId=$subscriptionId, cancelOption=$cancelOption, cancellationDate=$cancellationDate, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionCancelParams{subscriptionId=$subscriptionId, cancelOption=$cancelOption, cancellationDate=$cancellationDate, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -190,8 +192,8 @@ constructor( private var subscriptionId: String? = null private var cancelOption: CancelOption? = null private var cancellationDate: OffsetDateTime? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -199,8 +201,8 @@ constructor( this.subscriptionId = subscriptionCancelParams.subscriptionId this.cancelOption = subscriptionCancelParams.cancelOption this.cancellationDate = subscriptionCancelParams.cancellationDate - additionalQueryParams(subscriptionCancelParams.additionalQueryParams) additionalHeaders(subscriptionCancelParams.additionalHeaders) + additionalQueryParams(subscriptionCancelParams.additionalQueryParams) additionalBodyProperties(subscriptionCancelParams.additionalBodyProperties) } @@ -217,45 +219,79 @@ constructor( this.cancellationDate = cancellationDate } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -276,8 +312,14 @@ constructor( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, checkNotNull(cancelOption) { "`cancelOption` is required but was not set" }, cancellationDate, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt index 5ba4a9fbe..9eae0ed21 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer import com.withorb.api.core.Enum @@ -61,8 +63,8 @@ constructor( private val replacePrices: List?, private val startDate: OffsetDateTime?, private val trialDurationDays: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -166,10 +168,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = SubscriptionCreateBody.Builder::class) @NoAutoDetect class SubscriptionCreateBody @@ -697,10 +699,10 @@ constructor( "SubscriptionCreateBody{addAdjustments=$addAdjustments, addPrices=$addPrices, alignBillingWithSubscriptionStartDate=$alignBillingWithSubscriptionStartDate, autoCollection=$autoCollection, awsRegion=$awsRegion, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, couponRedemptionCode=$couponRedemptionCode, creditsOverageRate=$creditsOverageRate, customerId=$customerId, defaultInvoiceMemo=$defaultInvoiceMemo, endDate=$endDate, externalCustomerId=$externalCustomerId, externalMarketplace=$externalMarketplace, externalMarketplaceReportingId=$externalMarketplaceReportingId, externalPlanId=$externalPlanId, initialPhaseOrder=$initialPhaseOrder, invoicingThreshold=$invoicingThreshold, metadata=$metadata, netTerms=$netTerms, perCreditOverageAmount=$perCreditOverageAmount, planId=$planId, planVersionNumber=$planVersionNumber, priceOverrides=$priceOverrides, removeAdjustments=$removeAdjustments, removePrices=$removePrices, replaceAdjustments=$replaceAdjustments, replacePrices=$replacePrices, startDate=$startDate, trialDurationDays=$trialDurationDays, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -708,15 +710,15 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionCreateParams && this.addAdjustments == other.addAdjustments && this.addPrices == other.addPrices && this.alignBillingWithSubscriptionStartDate == other.alignBillingWithSubscriptionStartDate && this.autoCollection == other.autoCollection && this.awsRegion == other.awsRegion && this.billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && this.couponRedemptionCode == other.couponRedemptionCode && this.creditsOverageRate == other.creditsOverageRate && this.customerId == other.customerId && this.defaultInvoiceMemo == other.defaultInvoiceMemo && this.endDate == other.endDate && this.externalCustomerId == other.externalCustomerId && this.externalMarketplace == other.externalMarketplace && this.externalMarketplaceReportingId == other.externalMarketplaceReportingId && this.externalPlanId == other.externalPlanId && this.initialPhaseOrder == other.initialPhaseOrder && this.invoicingThreshold == other.invoicingThreshold && this.metadata == other.metadata && this.netTerms == other.netTerms && this.perCreditOverageAmount == other.perCreditOverageAmount && this.planId == other.planId && this.planVersionNumber == other.planVersionNumber && this.priceOverrides == other.priceOverrides && this.removeAdjustments == other.removeAdjustments && this.removePrices == other.removePrices && this.replaceAdjustments == other.replaceAdjustments && this.replacePrices == other.replacePrices && this.startDate == other.startDate && this.trialDurationDays == other.trialDurationDays && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionCreateParams && this.addAdjustments == other.addAdjustments && this.addPrices == other.addPrices && this.alignBillingWithSubscriptionStartDate == other.alignBillingWithSubscriptionStartDate && this.autoCollection == other.autoCollection && this.awsRegion == other.awsRegion && this.billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && this.couponRedemptionCode == other.couponRedemptionCode && this.creditsOverageRate == other.creditsOverageRate && this.customerId == other.customerId && this.defaultInvoiceMemo == other.defaultInvoiceMemo && this.endDate == other.endDate && this.externalCustomerId == other.externalCustomerId && this.externalMarketplace == other.externalMarketplace && this.externalMarketplaceReportingId == other.externalMarketplaceReportingId && this.externalPlanId == other.externalPlanId && this.initialPhaseOrder == other.initialPhaseOrder && this.invoicingThreshold == other.invoicingThreshold && this.metadata == other.metadata && this.netTerms == other.netTerms && this.perCreditOverageAmount == other.perCreditOverageAmount && this.planId == other.planId && this.planVersionNumber == other.planVersionNumber && this.priceOverrides == other.priceOverrides && this.removeAdjustments == other.removeAdjustments && this.removePrices == other.removePrices && this.replaceAdjustments == other.replaceAdjustments && this.replacePrices == other.replacePrices && this.startDate == other.startDate && this.trialDurationDays == other.trialDurationDays && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(addAdjustments, addPrices, alignBillingWithSubscriptionStartDate, autoCollection, awsRegion, billingCycleAnchorConfiguration, couponRedemptionCode, creditsOverageRate, customerId, defaultInvoiceMemo, endDate, externalCustomerId, externalMarketplace, externalMarketplaceReportingId, externalPlanId, initialPhaseOrder, invoicingThreshold, metadata, netTerms, perCreditOverageAmount, planId, planVersionNumber, priceOverrides, removeAdjustments, removePrices, replaceAdjustments, replacePrices, startDate, trialDurationDays, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(addAdjustments, addPrices, alignBillingWithSubscriptionStartDate, autoCollection, awsRegion, billingCycleAnchorConfiguration, couponRedemptionCode, creditsOverageRate, customerId, defaultInvoiceMemo, endDate, externalCustomerId, externalMarketplace, externalMarketplaceReportingId, externalPlanId, initialPhaseOrder, invoicingThreshold, metadata, netTerms, perCreditOverageAmount, planId, planVersionNumber, priceOverrides, removeAdjustments, removePrices, replaceAdjustments, replacePrices, startDate, trialDurationDays, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "SubscriptionCreateParams{addAdjustments=$addAdjustments, addPrices=$addPrices, alignBillingWithSubscriptionStartDate=$alignBillingWithSubscriptionStartDate, autoCollection=$autoCollection, awsRegion=$awsRegion, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, couponRedemptionCode=$couponRedemptionCode, creditsOverageRate=$creditsOverageRate, customerId=$customerId, defaultInvoiceMemo=$defaultInvoiceMemo, endDate=$endDate, externalCustomerId=$externalCustomerId, externalMarketplace=$externalMarketplace, externalMarketplaceReportingId=$externalMarketplaceReportingId, externalPlanId=$externalPlanId, initialPhaseOrder=$initialPhaseOrder, invoicingThreshold=$invoicingThreshold, metadata=$metadata, netTerms=$netTerms, perCreditOverageAmount=$perCreditOverageAmount, planId=$planId, planVersionNumber=$planVersionNumber, priceOverrides=$priceOverrides, removeAdjustments=$removeAdjustments, removePrices=$removePrices, replaceAdjustments=$replaceAdjustments, replacePrices=$replacePrices, startDate=$startDate, trialDurationDays=$trialDurationDays, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionCreateParams{addAdjustments=$addAdjustments, addPrices=$addPrices, alignBillingWithSubscriptionStartDate=$alignBillingWithSubscriptionStartDate, autoCollection=$autoCollection, awsRegion=$awsRegion, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, couponRedemptionCode=$couponRedemptionCode, creditsOverageRate=$creditsOverageRate, customerId=$customerId, defaultInvoiceMemo=$defaultInvoiceMemo, endDate=$endDate, externalCustomerId=$externalCustomerId, externalMarketplace=$externalMarketplace, externalMarketplaceReportingId=$externalMarketplaceReportingId, externalPlanId=$externalPlanId, initialPhaseOrder=$initialPhaseOrder, invoicingThreshold=$invoicingThreshold, metadata=$metadata, netTerms=$netTerms, perCreditOverageAmount=$perCreditOverageAmount, planId=$planId, planVersionNumber=$planVersionNumber, priceOverrides=$priceOverrides, removeAdjustments=$removeAdjustments, removePrices=$removePrices, replaceAdjustments=$replaceAdjustments, replacePrices=$replacePrices, startDate=$startDate, trialDurationDays=$trialDurationDays, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -757,8 +759,8 @@ constructor( private var replacePrices: MutableList = mutableListOf() private var startDate: OffsetDateTime? = null private var trialDurationDays: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -795,8 +797,8 @@ constructor( this.replacePrices(subscriptionCreateParams.replacePrices ?: listOf()) this.startDate = subscriptionCreateParams.startDate this.trialDurationDays = subscriptionCreateParams.trialDurationDays - additionalQueryParams(subscriptionCreateParams.additionalQueryParams) additionalHeaders(subscriptionCreateParams.additionalHeaders) + additionalQueryParams(subscriptionCreateParams.additionalQueryParams) additionalBodyProperties(subscriptionCreateParams.additionalBodyProperties) } @@ -1026,45 +1028,79 @@ constructor( this.trialDurationDays = trialDurationDays } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -1111,8 +1147,14 @@ constructor( if (replacePrices.size == 0) null else replacePrices.toImmutable(), startDate, trialDurationDays, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsParams.kt index 5c9c833c9..8bee21642 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsParams.kt @@ -3,6 +3,8 @@ package com.withorb.api.models import com.fasterxml.jackson.annotation.JsonCreator +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.JsonValue @@ -22,8 +24,8 @@ constructor( private val timeframeEnd: OffsetDateTime?, private val timeframeStart: OffsetDateTime?, private val viewMode: ViewMode?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun subscriptionId(): String = subscriptionId @@ -36,6 +38,8 @@ constructor( fun viewMode(): Optional = Optional.ofNullable(viewMode) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -51,8 +55,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -60,24 +62,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is SubscriptionFetchCostsParams && this.subscriptionId == other.subscriptionId && this.currency == other.currency && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.viewMode == other.viewMode && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is SubscriptionFetchCostsParams && this.subscriptionId == other.subscriptionId && this.currency == other.currency && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.viewMode == other.viewMode && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, currency, timeframeEnd, timeframeStart, viewMode, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, currency, timeframeEnd, timeframeStart, viewMode, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "SubscriptionFetchCostsParams{subscriptionId=$subscriptionId, currency=$currency, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, viewMode=$viewMode, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "SubscriptionFetchCostsParams{subscriptionId=$subscriptionId, currency=$currency, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, viewMode=$viewMode, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -94,8 +96,8 @@ constructor( private var timeframeEnd: OffsetDateTime? = null private var timeframeStart: OffsetDateTime? = null private var viewMode: ViewMode? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(subscriptionFetchCostsParams: SubscriptionFetchCostsParams) = apply { @@ -104,8 +106,8 @@ constructor( this.timeframeEnd = subscriptionFetchCostsParams.timeframeEnd this.timeframeStart = subscriptionFetchCostsParams.timeframeStart this.viewMode = subscriptionFetchCostsParams.viewMode - additionalQueryParams(subscriptionFetchCostsParams.additionalQueryParams) additionalHeaders(subscriptionFetchCostsParams.additionalHeaders) + additionalQueryParams(subscriptionFetchCostsParams.additionalQueryParams) } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } @@ -128,45 +130,79 @@ constructor( */ fun viewMode(viewMode: ViewMode) = apply { this.viewMode = viewMode } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): SubscriptionFetchCostsParams = SubscriptionFetchCostsParams( @@ -175,8 +211,14 @@ constructor( timeframeEnd, timeframeStart, viewMode, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchParams.kt index 7447db51c..56e8dd361 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -10,16 +12,16 @@ import java.util.Objects class SubscriptionFetchParams constructor( private val subscriptionId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun subscriptionId(): String = subscriptionId - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -27,24 +29,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is SubscriptionFetchParams && this.subscriptionId == other.subscriptionId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is SubscriptionFetchParams && this.subscriptionId == other.subscriptionId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "SubscriptionFetchParams{subscriptionId=$subscriptionId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "SubscriptionFetchParams{subscriptionId=$subscriptionId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -57,63 +59,103 @@ constructor( class Builder { private var subscriptionId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(subscriptionFetchParams: SubscriptionFetchParams) = apply { this.subscriptionId = subscriptionFetchParams.subscriptionId - additionalQueryParams(subscriptionFetchParams.additionalQueryParams) additionalHeaders(subscriptionFetchParams.additionalHeaders) + additionalQueryParams(subscriptionFetchParams.additionalQueryParams) } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): SubscriptionFetchParams = SubscriptionFetchParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleParams.kt index 9dd38effb..bc63fcea1 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -19,8 +21,8 @@ constructor( private val startDateGte: OffsetDateTime?, private val startDateLt: OffsetDateTime?, private val startDateLte: OffsetDateTime?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun subscriptionId(): String = subscriptionId @@ -37,6 +39,8 @@ constructor( fun startDateLte(): Optional = Optional.ofNullable(startDateLte) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -58,8 +62,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -67,24 +69,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is SubscriptionFetchScheduleParams && this.subscriptionId == other.subscriptionId && this.cursor == other.cursor && this.limit == other.limit && this.startDateGt == other.startDateGt && this.startDateGte == other.startDateGte && this.startDateLt == other.startDateLt && this.startDateLte == other.startDateLte && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is SubscriptionFetchScheduleParams && this.subscriptionId == other.subscriptionId && this.cursor == other.cursor && this.limit == other.limit && this.startDateGt == other.startDateGt && this.startDateGte == other.startDateGte && this.startDateLt == other.startDateLt && this.startDateLte == other.startDateLte && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, cursor, limit, startDateGt, startDateGte, startDateLt, startDateLte, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, cursor, limit, startDateGt, startDateGte, startDateLt, startDateLte, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "SubscriptionFetchScheduleParams{subscriptionId=$subscriptionId, cursor=$cursor, limit=$limit, startDateGt=$startDateGt, startDateGte=$startDateGte, startDateLt=$startDateLt, startDateLte=$startDateLte, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "SubscriptionFetchScheduleParams{subscriptionId=$subscriptionId, cursor=$cursor, limit=$limit, startDateGt=$startDateGt, startDateGte=$startDateGte, startDateLt=$startDateLt, startDateLte=$startDateLte, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -103,8 +105,8 @@ constructor( private var startDateGte: OffsetDateTime? = null private var startDateLt: OffsetDateTime? = null private var startDateLte: OffsetDateTime? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(subscriptionFetchScheduleParams: SubscriptionFetchScheduleParams) = @@ -116,8 +118,8 @@ constructor( this.startDateGte = subscriptionFetchScheduleParams.startDateGte this.startDateLt = subscriptionFetchScheduleParams.startDateLt this.startDateLte = subscriptionFetchScheduleParams.startDateLte - additionalQueryParams(subscriptionFetchScheduleParams.additionalQueryParams) additionalHeaders(subscriptionFetchScheduleParams.additionalHeaders) + additionalQueryParams(subscriptionFetchScheduleParams.additionalQueryParams) } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } @@ -139,45 +141,79 @@ constructor( fun startDateLte(startDateLte: OffsetDateTime) = apply { this.startDateLte = startDateLte } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): SubscriptionFetchScheduleParams = SubscriptionFetchScheduleParams( @@ -188,8 +224,14 @@ constructor( startDateGte, startDateLt, startDateLte, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchUsageParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchUsageParams.kt index e55e6da77..0e585128d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchUsageParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchUsageParams.kt @@ -3,6 +3,8 @@ package com.withorb.api.models import com.fasterxml.jackson.annotation.JsonCreator +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.JsonValue @@ -28,8 +30,8 @@ constructor( private val timeframeEnd: OffsetDateTime?, private val timeframeStart: OffsetDateTime?, private val viewMode: ViewMode?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun subscriptionId(): String = subscriptionId @@ -54,6 +56,8 @@ constructor( fun viewMode(): Optional = Optional.ofNullable(viewMode) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -77,8 +81,6 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -86,24 +88,24 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is SubscriptionFetchUsageParams && this.subscriptionId == other.subscriptionId && this.billableMetricId == other.billableMetricId && this.firstDimensionKey == other.firstDimensionKey && this.firstDimensionValue == other.firstDimensionValue && this.granularity == other.granularity && this.groupBy == other.groupBy && this.secondDimensionKey == other.secondDimensionKey && this.secondDimensionValue == other.secondDimensionValue && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.viewMode == other.viewMode && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is SubscriptionFetchUsageParams && this.subscriptionId == other.subscriptionId && this.billableMetricId == other.billableMetricId && this.firstDimensionKey == other.firstDimensionKey && this.firstDimensionValue == other.firstDimensionValue && this.granularity == other.granularity && this.groupBy == other.groupBy && this.secondDimensionKey == other.secondDimensionKey && this.secondDimensionValue == other.secondDimensionValue && this.timeframeEnd == other.timeframeEnd && this.timeframeStart == other.timeframeStart && this.viewMode == other.viewMode && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, billableMetricId, firstDimensionKey, firstDimensionValue, granularity, groupBy, secondDimensionKey, secondDimensionValue, timeframeEnd, timeframeStart, viewMode, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, billableMetricId, firstDimensionKey, firstDimensionValue, granularity, groupBy, secondDimensionKey, secondDimensionValue, timeframeEnd, timeframeStart, viewMode, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "SubscriptionFetchUsageParams{subscriptionId=$subscriptionId, billableMetricId=$billableMetricId, firstDimensionKey=$firstDimensionKey, firstDimensionValue=$firstDimensionValue, granularity=$granularity, groupBy=$groupBy, secondDimensionKey=$secondDimensionKey, secondDimensionValue=$secondDimensionValue, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, viewMode=$viewMode, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "SubscriptionFetchUsageParams{subscriptionId=$subscriptionId, billableMetricId=$billableMetricId, firstDimensionKey=$firstDimensionKey, firstDimensionValue=$firstDimensionValue, granularity=$granularity, groupBy=$groupBy, secondDimensionKey=$secondDimensionKey, secondDimensionValue=$secondDimensionValue, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, viewMode=$viewMode, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -126,8 +128,8 @@ constructor( private var timeframeEnd: OffsetDateTime? = null private var timeframeStart: OffsetDateTime? = null private var viewMode: ViewMode? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(subscriptionFetchUsageParams: SubscriptionFetchUsageParams) = apply { @@ -142,8 +144,8 @@ constructor( this.timeframeEnd = subscriptionFetchUsageParams.timeframeEnd this.timeframeStart = subscriptionFetchUsageParams.timeframeStart this.viewMode = subscriptionFetchUsageParams.viewMode - additionalQueryParams(subscriptionFetchUsageParams.additionalQueryParams) additionalHeaders(subscriptionFetchUsageParams.additionalHeaders) + additionalQueryParams(subscriptionFetchUsageParams.additionalQueryParams) } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } @@ -194,45 +196,79 @@ constructor( */ fun viewMode(viewMode: ViewMode) = apply { this.viewMode = viewMode } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): SubscriptionFetchUsageParams = SubscriptionFetchUsageParams( @@ -247,8 +283,14 @@ constructor( timeframeEnd, timeframeStart, viewMode, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt index c6968843d..b1e22ad72 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt @@ -3,6 +3,8 @@ package com.withorb.api.models import com.fasterxml.jackson.annotation.JsonCreator +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.JsonField import com.withorb.api.core.JsonValue @@ -26,8 +28,8 @@ constructor( private val externalCustomerId: String?, private val limit: Long?, private val status: Status?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { fun createdAtGt(): Optional = Optional.ofNullable(createdAtGt) @@ -48,6 +50,8 @@ constructor( fun status(): Optional = Optional.ofNullable(status) + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> { val params = mutableMapOf>() @@ -72,26 +76,24 @@ constructor( return params.toImmutable() } - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + fun _additionalHeaders(): Map> = additionalHeaders fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is SubscriptionListParams && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.cursor == other.cursor && this.customerId == other.customerId && this.externalCustomerId == other.externalCustomerId && this.limit == other.limit && this.status == other.status && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is SubscriptionListParams && this.createdAtGt == other.createdAtGt && this.createdAtGte == other.createdAtGte && this.createdAtLt == other.createdAtLt && this.createdAtLte == other.createdAtLte && this.cursor == other.cursor && this.customerId == other.customerId && this.externalCustomerId == other.externalCustomerId && this.limit == other.limit && this.status == other.status && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(createdAtGt, createdAtGte, createdAtLt, createdAtLte, cursor, customerId, externalCustomerId, limit, status, additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(createdAtGt, createdAtGte, createdAtLt, createdAtLte, cursor, customerId, externalCustomerId, limit, status, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "SubscriptionListParams{createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, cursor=$cursor, customerId=$customerId, externalCustomerId=$externalCustomerId, limit=$limit, status=$status, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "SubscriptionListParams{createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, cursor=$cursor, customerId=$customerId, externalCustomerId=$externalCustomerId, limit=$limit, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -112,8 +114,8 @@ constructor( private var externalCustomerId: String? = null private var limit: Long? = null private var status: Status? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(subscriptionListParams: SubscriptionListParams) = apply { @@ -126,8 +128,8 @@ constructor( this.externalCustomerId = subscriptionListParams.externalCustomerId this.limit = subscriptionListParams.limit this.status = subscriptionListParams.status - additionalQueryParams(subscriptionListParams.additionalQueryParams) additionalHeaders(subscriptionListParams.additionalHeaders) + additionalQueryParams(subscriptionListParams.additionalQueryParams) } fun createdAtGt(createdAtGt: OffsetDateTime) = apply { this.createdAtGt = createdAtGt } @@ -160,45 +162,79 @@ constructor( fun status(status: Status) = apply { this.status = status } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): SubscriptionListParams = SubscriptionListParams( @@ -211,8 +247,14 @@ constructor( externalCustomerId, limit, status, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt index 5fd1a0fbd..4dad22c92 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer import com.withorb.api.core.Enum @@ -37,8 +39,8 @@ constructor( private val addAdjustments: List?, private val edit: List?, private val editAdjustments: List?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -63,10 +65,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -190,10 +192,10 @@ constructor( "SubscriptionPriceIntervalsBody{add=$add, addAdjustments=$addAdjustments, edit=$edit, editAdjustments=$editAdjustments, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -201,15 +203,15 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionPriceIntervalsParams && this.subscriptionId == other.subscriptionId && this.add == other.add && this.addAdjustments == other.addAdjustments && this.edit == other.edit && this.editAdjustments == other.editAdjustments && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionPriceIntervalsParams && this.subscriptionId == other.subscriptionId && this.add == other.add && this.addAdjustments == other.addAdjustments && this.edit == other.edit && this.editAdjustments == other.editAdjustments && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, add, addAdjustments, edit, editAdjustments, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, add, addAdjustments, edit, editAdjustments, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "SubscriptionPriceIntervalsParams{subscriptionId=$subscriptionId, add=$add, addAdjustments=$addAdjustments, edit=$edit, editAdjustments=$editAdjustments, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionPriceIntervalsParams{subscriptionId=$subscriptionId, add=$add, addAdjustments=$addAdjustments, edit=$edit, editAdjustments=$editAdjustments, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -226,8 +228,8 @@ constructor( private var addAdjustments: MutableList = mutableListOf() private var edit: MutableList = mutableListOf() private var editAdjustments: MutableList = mutableListOf() - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -238,8 +240,8 @@ constructor( this.addAdjustments(subscriptionPriceIntervalsParams.addAdjustments ?: listOf()) this.edit(subscriptionPriceIntervalsParams.edit ?: listOf()) this.editAdjustments(subscriptionPriceIntervalsParams.editAdjustments ?: listOf()) - additionalQueryParams(subscriptionPriceIntervalsParams.additionalQueryParams) additionalHeaders(subscriptionPriceIntervalsParams.additionalHeaders) + additionalQueryParams(subscriptionPriceIntervalsParams.additionalQueryParams) additionalBodyProperties(subscriptionPriceIntervalsParams.additionalBodyProperties) } @@ -285,45 +287,79 @@ constructor( this.editAdjustments.add(editAdjustment) } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -346,8 +382,14 @@ constructor( if (addAdjustments.size == 0) null else addAdjustments.toImmutable(), if (edit.size == 0) null else edit.toImmutable(), if (editAdjustments.size == 0) null else editAdjustments.toImmutable(), - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt index d8a67f306..84f90e52a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer import com.withorb.api.core.Enum @@ -56,8 +58,8 @@ constructor( private val replaceAdjustments: List?, private val replacePrices: List?, private val trialDurationDays: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -143,10 +145,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -635,10 +637,10 @@ constructor( "SubscriptionSchedulePlanChangeBody{changeOption=$changeOption, addAdjustments=$addAdjustments, addPrices=$addPrices, alignBillingWithPlanChangeDate=$alignBillingWithPlanChangeDate, autoCollection=$autoCollection, billingCycleAlignment=$billingCycleAlignment, changeDate=$changeDate, couponRedemptionCode=$couponRedemptionCode, creditsOverageRate=$creditsOverageRate, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, initialPhaseOrder=$initialPhaseOrder, invoicingThreshold=$invoicingThreshold, netTerms=$netTerms, perCreditOverageAmount=$perCreditOverageAmount, planId=$planId, planVersionNumber=$planVersionNumber, priceOverrides=$priceOverrides, removeAdjustments=$removeAdjustments, removePrices=$removePrices, replaceAdjustments=$replaceAdjustments, replacePrices=$replacePrices, trialDurationDays=$trialDurationDays, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -646,15 +648,15 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionSchedulePlanChangeParams && this.subscriptionId == other.subscriptionId && this.changeOption == other.changeOption && this.addAdjustments == other.addAdjustments && this.addPrices == other.addPrices && this.alignBillingWithPlanChangeDate == other.alignBillingWithPlanChangeDate && this.autoCollection == other.autoCollection && this.billingCycleAlignment == other.billingCycleAlignment && this.changeDate == other.changeDate && this.couponRedemptionCode == other.couponRedemptionCode && this.creditsOverageRate == other.creditsOverageRate && this.defaultInvoiceMemo == other.defaultInvoiceMemo && this.externalPlanId == other.externalPlanId && this.initialPhaseOrder == other.initialPhaseOrder && this.invoicingThreshold == other.invoicingThreshold && this.netTerms == other.netTerms && this.perCreditOverageAmount == other.perCreditOverageAmount && this.planId == other.planId && this.planVersionNumber == other.planVersionNumber && this.priceOverrides == other.priceOverrides && this.removeAdjustments == other.removeAdjustments && this.removePrices == other.removePrices && this.replaceAdjustments == other.replaceAdjustments && this.replacePrices == other.replacePrices && this.trialDurationDays == other.trialDurationDays && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionSchedulePlanChangeParams && this.subscriptionId == other.subscriptionId && this.changeOption == other.changeOption && this.addAdjustments == other.addAdjustments && this.addPrices == other.addPrices && this.alignBillingWithPlanChangeDate == other.alignBillingWithPlanChangeDate && this.autoCollection == other.autoCollection && this.billingCycleAlignment == other.billingCycleAlignment && this.changeDate == other.changeDate && this.couponRedemptionCode == other.couponRedemptionCode && this.creditsOverageRate == other.creditsOverageRate && this.defaultInvoiceMemo == other.defaultInvoiceMemo && this.externalPlanId == other.externalPlanId && this.initialPhaseOrder == other.initialPhaseOrder && this.invoicingThreshold == other.invoicingThreshold && this.netTerms == other.netTerms && this.perCreditOverageAmount == other.perCreditOverageAmount && this.planId == other.planId && this.planVersionNumber == other.planVersionNumber && this.priceOverrides == other.priceOverrides && this.removeAdjustments == other.removeAdjustments && this.removePrices == other.removePrices && this.replaceAdjustments == other.replaceAdjustments && this.replacePrices == other.replacePrices && this.trialDurationDays == other.trialDurationDays && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, changeOption, addAdjustments, addPrices, alignBillingWithPlanChangeDate, autoCollection, billingCycleAlignment, changeDate, couponRedemptionCode, creditsOverageRate, defaultInvoiceMemo, externalPlanId, initialPhaseOrder, invoicingThreshold, netTerms, perCreditOverageAmount, planId, planVersionNumber, priceOverrides, removeAdjustments, removePrices, replaceAdjustments, replacePrices, trialDurationDays, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, changeOption, addAdjustments, addPrices, alignBillingWithPlanChangeDate, autoCollection, billingCycleAlignment, changeDate, couponRedemptionCode, creditsOverageRate, defaultInvoiceMemo, externalPlanId, initialPhaseOrder, invoicingThreshold, netTerms, perCreditOverageAmount, planId, planVersionNumber, priceOverrides, removeAdjustments, removePrices, replaceAdjustments, replacePrices, trialDurationDays, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "SubscriptionSchedulePlanChangeParams{subscriptionId=$subscriptionId, changeOption=$changeOption, addAdjustments=$addAdjustments, addPrices=$addPrices, alignBillingWithPlanChangeDate=$alignBillingWithPlanChangeDate, autoCollection=$autoCollection, billingCycleAlignment=$billingCycleAlignment, changeDate=$changeDate, couponRedemptionCode=$couponRedemptionCode, creditsOverageRate=$creditsOverageRate, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, initialPhaseOrder=$initialPhaseOrder, invoicingThreshold=$invoicingThreshold, netTerms=$netTerms, perCreditOverageAmount=$perCreditOverageAmount, planId=$planId, planVersionNumber=$planVersionNumber, priceOverrides=$priceOverrides, removeAdjustments=$removeAdjustments, removePrices=$removePrices, replaceAdjustments=$replaceAdjustments, replacePrices=$replacePrices, trialDurationDays=$trialDurationDays, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionSchedulePlanChangeParams{subscriptionId=$subscriptionId, changeOption=$changeOption, addAdjustments=$addAdjustments, addPrices=$addPrices, alignBillingWithPlanChangeDate=$alignBillingWithPlanChangeDate, autoCollection=$autoCollection, billingCycleAlignment=$billingCycleAlignment, changeDate=$changeDate, couponRedemptionCode=$couponRedemptionCode, creditsOverageRate=$creditsOverageRate, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, initialPhaseOrder=$initialPhaseOrder, invoicingThreshold=$invoicingThreshold, netTerms=$netTerms, perCreditOverageAmount=$perCreditOverageAmount, planId=$planId, planVersionNumber=$planVersionNumber, priceOverrides=$priceOverrides, removeAdjustments=$removeAdjustments, removePrices=$removePrices, replaceAdjustments=$replaceAdjustments, replacePrices=$replacePrices, trialDurationDays=$trialDurationDays, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -690,8 +692,8 @@ constructor( private var replaceAdjustments: MutableList = mutableListOf() private var replacePrices: MutableList = mutableListOf() private var trialDurationDays: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -728,8 +730,8 @@ constructor( ) this.replacePrices(subscriptionSchedulePlanChangeParams.replacePrices ?: listOf()) this.trialDurationDays = subscriptionSchedulePlanChangeParams.trialDurationDays - additionalQueryParams(subscriptionSchedulePlanChangeParams.additionalQueryParams) additionalHeaders(subscriptionSchedulePlanChangeParams.additionalHeaders) + additionalQueryParams(subscriptionSchedulePlanChangeParams.additionalQueryParams) additionalBodyProperties(subscriptionSchedulePlanChangeParams.additionalBodyProperties) } @@ -950,45 +952,79 @@ constructor( this.trialDurationDays = trialDurationDays } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -1030,8 +1066,14 @@ constructor( if (replaceAdjustments.size == 0) null else replaceAdjustments.toImmutable(), if (replacePrices.size == 0) null else replacePrices.toImmutable(), trialDurationDays, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt index a7929fad5..f14ec707a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -19,8 +21,8 @@ class SubscriptionTriggerPhaseParams constructor( private val subscriptionId: String, private val effectiveDate: LocalDate?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -33,10 +35,10 @@ constructor( return SubscriptionTriggerPhaseBody(effectiveDate, additionalBodyProperties) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -128,10 +130,10 @@ constructor( "SubscriptionTriggerPhaseBody{effectiveDate=$effectiveDate, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -139,15 +141,15 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionTriggerPhaseParams && this.subscriptionId == other.subscriptionId && this.effectiveDate == other.effectiveDate && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionTriggerPhaseParams && this.subscriptionId == other.subscriptionId && this.effectiveDate == other.effectiveDate && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, effectiveDate, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, effectiveDate, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "SubscriptionTriggerPhaseParams{subscriptionId=$subscriptionId, effectiveDate=$effectiveDate, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionTriggerPhaseParams{subscriptionId=$subscriptionId, effectiveDate=$effectiveDate, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -161,16 +163,16 @@ constructor( private var subscriptionId: String? = null private var effectiveDate: LocalDate? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionTriggerPhaseParams: SubscriptionTriggerPhaseParams) = apply { this.subscriptionId = subscriptionTriggerPhaseParams.subscriptionId this.effectiveDate = subscriptionTriggerPhaseParams.effectiveDate - additionalQueryParams(subscriptionTriggerPhaseParams.additionalQueryParams) additionalHeaders(subscriptionTriggerPhaseParams.additionalHeaders) + additionalQueryParams(subscriptionTriggerPhaseParams.additionalQueryParams) additionalBodyProperties(subscriptionTriggerPhaseParams.additionalBodyProperties) } @@ -182,45 +184,79 @@ constructor( */ fun effectiveDate(effectiveDate: LocalDate) = apply { this.effectiveDate = effectiveDate } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -240,8 +276,14 @@ constructor( SubscriptionTriggerPhaseParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, effectiveDate, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt index 0ba9d6e8b..991a61724 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable @@ -12,8 +14,8 @@ import java.util.Optional class SubscriptionUnscheduleCancellationParams constructor( private val subscriptionId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -24,10 +26,10 @@ constructor( return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -35,10 +37,10 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -46,15 +48,15 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionUnscheduleCancellationParams && this.subscriptionId == other.subscriptionId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUnscheduleCancellationParams && this.subscriptionId == other.subscriptionId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "SubscriptionUnscheduleCancellationParams{subscriptionId=$subscriptionId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionUnscheduleCancellationParams{subscriptionId=$subscriptionId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -67,8 +69,8 @@ constructor( class Builder { private var subscriptionId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -76,8 +78,8 @@ constructor( subscriptionUnscheduleCancellationParams: SubscriptionUnscheduleCancellationParams ) = apply { this.subscriptionId = subscriptionUnscheduleCancellationParams.subscriptionId - additionalQueryParams(subscriptionUnscheduleCancellationParams.additionalQueryParams) additionalHeaders(subscriptionUnscheduleCancellationParams.additionalHeaders) + additionalQueryParams(subscriptionUnscheduleCancellationParams.additionalQueryParams) additionalBodyProperties( subscriptionUnscheduleCancellationParams.additionalBodyProperties ) @@ -85,45 +87,79 @@ constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -142,8 +178,14 @@ constructor( fun build(): SubscriptionUnscheduleCancellationParams = SubscriptionUnscheduleCancellationParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt index 8010f29cd..a1977b8e2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -17,8 +19,8 @@ class SubscriptionUnscheduleFixedFeeQuantityUpdatesParams constructor( private val subscriptionId: String, private val priceId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -31,10 +33,10 @@ constructor( return SubscriptionUnscheduleFixedFeeQuantityUpdatesBody(priceId, additionalBodyProperties) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -126,10 +128,10 @@ constructor( "SubscriptionUnscheduleFixedFeeQuantityUpdatesBody{priceId=$priceId, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -137,15 +139,15 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionUnscheduleFixedFeeQuantityUpdatesParams && this.subscriptionId == other.subscriptionId && this.priceId == other.priceId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUnscheduleFixedFeeQuantityUpdatesParams && this.subscriptionId == other.subscriptionId && this.priceId == other.priceId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, priceId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, priceId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "SubscriptionUnscheduleFixedFeeQuantityUpdatesParams{subscriptionId=$subscriptionId, priceId=$priceId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionUnscheduleFixedFeeQuantityUpdatesParams{subscriptionId=$subscriptionId, priceId=$priceId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -159,8 +161,8 @@ constructor( private var subscriptionId: String? = null private var priceId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -170,10 +172,10 @@ constructor( ) = apply { this.subscriptionId = subscriptionUnscheduleFixedFeeQuantityUpdatesParams.subscriptionId this.priceId = subscriptionUnscheduleFixedFeeQuantityUpdatesParams.priceId + additionalHeaders(subscriptionUnscheduleFixedFeeQuantityUpdatesParams.additionalHeaders) additionalQueryParams( subscriptionUnscheduleFixedFeeQuantityUpdatesParams.additionalQueryParams ) - additionalHeaders(subscriptionUnscheduleFixedFeeQuantityUpdatesParams.additionalHeaders) additionalBodyProperties( subscriptionUnscheduleFixedFeeQuantityUpdatesParams.additionalBodyProperties ) @@ -184,45 +186,79 @@ constructor( /** Price for which the updates should be cleared. Must be a fixed fee. */ fun priceId(priceId: String) = apply { this.priceId = priceId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -242,8 +278,14 @@ constructor( SubscriptionUnscheduleFixedFeeQuantityUpdatesParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, checkNotNull(priceId) { "`priceId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt index 4637626bb..034537519 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable @@ -12,8 +14,8 @@ import java.util.Optional class SubscriptionUnschedulePendingPlanChangesParams constructor( private val subscriptionId: String, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -24,10 +26,10 @@ constructor( return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -35,10 +37,10 @@ constructor( } } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -46,15 +48,15 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionUnschedulePendingPlanChangesParams && this.subscriptionId == other.subscriptionId && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUnschedulePendingPlanChangesParams && this.subscriptionId == other.subscriptionId && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "SubscriptionUnschedulePendingPlanChangesParams{subscriptionId=$subscriptionId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionUnschedulePendingPlanChangesParams{subscriptionId=$subscriptionId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -67,8 +69,8 @@ constructor( class Builder { private var subscriptionId: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -77,10 +79,10 @@ constructor( SubscriptionUnschedulePendingPlanChangesParams ) = apply { this.subscriptionId = subscriptionUnschedulePendingPlanChangesParams.subscriptionId + additionalHeaders(subscriptionUnschedulePendingPlanChangesParams.additionalHeaders) additionalQueryParams( subscriptionUnschedulePendingPlanChangesParams.additionalQueryParams ) - additionalHeaders(subscriptionUnschedulePendingPlanChangesParams.additionalHeaders) additionalBodyProperties( subscriptionUnschedulePendingPlanChangesParams.additionalBodyProperties ) @@ -88,45 +90,79 @@ constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -145,8 +181,14 @@ constructor( fun build(): SubscriptionUnschedulePendingPlanChangesParams = SubscriptionUnschedulePendingPlanChangesParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt index 6fecabae8..35d7f8fad 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.Enum import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonField @@ -26,8 +28,8 @@ constructor( private val quantity: Double, private val changeOption: ChangeOption?, private val effectiveDate: LocalDate?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -52,10 +54,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -195,10 +197,10 @@ constructor( "SubscriptionUpdateFixedFeeQuantityBody{priceId=$priceId, quantity=$quantity, changeOption=$changeOption, effectiveDate=$effectiveDate, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -206,15 +208,15 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionUpdateFixedFeeQuantityParams && this.subscriptionId == other.subscriptionId && this.priceId == other.priceId && this.quantity == other.quantity && this.changeOption == other.changeOption && this.effectiveDate == other.effectiveDate && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUpdateFixedFeeQuantityParams && this.subscriptionId == other.subscriptionId && this.priceId == other.priceId && this.quantity == other.quantity && this.changeOption == other.changeOption && this.effectiveDate == other.effectiveDate && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, priceId, quantity, changeOption, effectiveDate, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, priceId, quantity, changeOption, effectiveDate, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "SubscriptionUpdateFixedFeeQuantityParams{subscriptionId=$subscriptionId, priceId=$priceId, quantity=$quantity, changeOption=$changeOption, effectiveDate=$effectiveDate, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionUpdateFixedFeeQuantityParams{subscriptionId=$subscriptionId, priceId=$priceId, quantity=$quantity, changeOption=$changeOption, effectiveDate=$effectiveDate, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -231,8 +233,8 @@ constructor( private var quantity: Double? = null private var changeOption: ChangeOption? = null private var effectiveDate: LocalDate? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -244,8 +246,8 @@ constructor( this.quantity = subscriptionUpdateFixedFeeQuantityParams.quantity this.changeOption = subscriptionUpdateFixedFeeQuantityParams.changeOption this.effectiveDate = subscriptionUpdateFixedFeeQuantityParams.effectiveDate - additionalQueryParams(subscriptionUpdateFixedFeeQuantityParams.additionalQueryParams) additionalHeaders(subscriptionUpdateFixedFeeQuantityParams.additionalHeaders) + additionalQueryParams(subscriptionUpdateFixedFeeQuantityParams.additionalQueryParams) additionalBodyProperties( subscriptionUpdateFixedFeeQuantityParams.additionalBodyProperties ) @@ -272,45 +274,79 @@ constructor( */ fun effectiveDate(effectiveDate: LocalDate) = apply { this.effectiveDate = effectiveDate } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -333,8 +369,14 @@ constructor( checkNotNull(quantity) { "`quantity` is required but was not set" }, changeOption, effectiveDate, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt index 815437ee7..9ce760cfa 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt @@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.ExcludeMissing import com.withorb.api.core.JsonValue import com.withorb.api.core.NoAutoDetect @@ -22,8 +24,8 @@ constructor( private val invoicingThreshold: String?, private val metadata: Metadata?, private val netTerms: Long?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -51,10 +53,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -230,10 +232,10 @@ constructor( "SubscriptionUpdateBody{autoCollection=$autoCollection, defaultInvoiceMemo=$defaultInvoiceMemo, invoicingThreshold=$invoicingThreshold, metadata=$metadata, netTerms=$netTerms, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -241,15 +243,15 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionUpdateParams && this.subscriptionId == other.subscriptionId && this.autoCollection == other.autoCollection && this.defaultInvoiceMemo == other.defaultInvoiceMemo && this.invoicingThreshold == other.invoicingThreshold && this.metadata == other.metadata && this.netTerms == other.netTerms && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUpdateParams && this.subscriptionId == other.subscriptionId && this.autoCollection == other.autoCollection && this.defaultInvoiceMemo == other.defaultInvoiceMemo && this.invoicingThreshold == other.invoicingThreshold && this.metadata == other.metadata && this.netTerms == other.netTerms && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, autoCollection, defaultInvoiceMemo, invoicingThreshold, metadata, netTerms, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, autoCollection, defaultInvoiceMemo, invoicingThreshold, metadata, netTerms, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "SubscriptionUpdateParams{subscriptionId=$subscriptionId, autoCollection=$autoCollection, defaultInvoiceMemo=$defaultInvoiceMemo, invoicingThreshold=$invoicingThreshold, metadata=$metadata, netTerms=$netTerms, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionUpdateParams{subscriptionId=$subscriptionId, autoCollection=$autoCollection, defaultInvoiceMemo=$defaultInvoiceMemo, invoicingThreshold=$invoicingThreshold, metadata=$metadata, netTerms=$netTerms, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -267,8 +269,8 @@ constructor( private var invoicingThreshold: String? = null private var metadata: Metadata? = null private var netTerms: Long? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -279,8 +281,8 @@ constructor( this.invoicingThreshold = subscriptionUpdateParams.invoicingThreshold this.metadata = subscriptionUpdateParams.metadata this.netTerms = subscriptionUpdateParams.netTerms - additionalQueryParams(subscriptionUpdateParams.additionalQueryParams) additionalHeaders(subscriptionUpdateParams.additionalHeaders) + additionalQueryParams(subscriptionUpdateParams.additionalQueryParams) additionalBodyProperties(subscriptionUpdateParams.additionalBodyProperties) } @@ -324,45 +326,79 @@ constructor( */ fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -386,8 +422,14 @@ constructor( invoicingThreshold, metadata, netTerms, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt index 3151357db..caa7a3bcc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.BaseDeserializer import com.withorb.api.core.BaseSerializer import com.withorb.api.core.Enum @@ -33,8 +35,8 @@ constructor( private val subscriptionId: String, private val trialEndDate: TrialEndDate, private val shift: Boolean?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -53,10 +55,10 @@ constructor( ) } - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + fun getPathParam(index: Int): String { return when (index) { 0 -> subscriptionId @@ -167,10 +169,10 @@ constructor( "SubscriptionUpdateTrialBody{trialEndDate=$trialEndDate, shift=$shift, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -178,15 +180,15 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionUpdateTrialParams && this.subscriptionId == other.subscriptionId && this.trialEndDate == other.trialEndDate && this.shift == other.shift && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUpdateTrialParams && this.subscriptionId == other.subscriptionId && this.trialEndDate == other.trialEndDate && this.shift == other.shift && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(subscriptionId, trialEndDate, shift, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(subscriptionId, trialEndDate, shift, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "SubscriptionUpdateTrialParams{subscriptionId=$subscriptionId, trialEndDate=$trialEndDate, shift=$shift, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionUpdateTrialParams{subscriptionId=$subscriptionId, trialEndDate=$trialEndDate, shift=$shift, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -201,8 +203,8 @@ constructor( private var subscriptionId: String? = null private var trialEndDate: TrialEndDate? = null private var shift: Boolean? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -210,8 +212,8 @@ constructor( this.subscriptionId = subscriptionUpdateTrialParams.subscriptionId this.trialEndDate = subscriptionUpdateTrialParams.trialEndDate this.shift = subscriptionUpdateTrialParams.shift - additionalQueryParams(subscriptionUpdateTrialParams.additionalQueryParams) additionalHeaders(subscriptionUpdateTrialParams.additionalHeaders) + additionalQueryParams(subscriptionUpdateTrialParams.additionalQueryParams) additionalBodyProperties(subscriptionUpdateTrialParams.additionalBodyProperties) } @@ -245,45 +247,79 @@ constructor( */ fun shift(shift: Boolean) = apply { this.shift = shift } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -304,8 +340,14 @@ constructor( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, checkNotNull(trialEndDate) { "`trialEndDate` is required but was not set" }, shift, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/TopLevelPingParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/TopLevelPingParams.kt index 4e77157c7..2ec74d71f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/TopLevelPingParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/TopLevelPingParams.kt @@ -2,6 +2,8 @@ package com.withorb.api.models +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.toImmutable import com.withorb.api.models.* @@ -9,32 +11,32 @@ import java.util.Objects class TopLevelPingParams constructor( - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, ) { - @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams - @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders - fun _additionalQueryParams(): Map> = additionalQueryParams + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is TopLevelPingParams && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders /* spotless:on */ + return /* spotless:off */ other is TopLevelPingParams && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(additionalQueryParams, additionalHeaders) /* spotless:on */ + return /* spotless:off */ Objects.hash(additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "TopLevelPingParams{additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders}" + "TopLevelPingParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -46,59 +48,99 @@ constructor( @NoAutoDetect class Builder { - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @JvmSynthetic internal fun from(topLevelPingParams: TopLevelPingParams) = apply { - additionalQueryParams(topLevelPingParams.additionalQueryParams) additionalHeaders(topLevelPingParams.additionalHeaders) + additionalQueryParams(topLevelPingParams.additionalQueryParams) } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replaceValues(name, listOf(value)) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replaceValues(name, values) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::replaceAdditionalHeaders) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.removeAll(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + names.forEach(::removeAdditionalHeaders) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replaceValues(key, listOf(value)) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replaceValues(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::replaceAdditionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { + additionalQueryParams.removeAll(key) + } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + keys.forEach(::removeAdditionalQueryParams) + } fun build(): TopLevelPingParams = TopLevelPingParams( - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable() + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable() ) } } 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 324bfa993..ca0b96a53 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 @@ -43,10 +43,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("alerts", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -72,10 +72,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("alerts", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -113,10 +113,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("alerts") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -151,10 +151,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("alerts", "customer_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -189,10 +189,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("alerts", "external_customer_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -230,10 +230,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("alerts", "subscription_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -260,10 +260,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("alerts", params.getPathParam(0), "disable") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -290,10 +290,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("alerts", params.getPathParam(0), "enable") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response 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 153f21f69..2ad901eda 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 @@ -50,10 +50,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("coupons") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -88,10 +88,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("coupons") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -122,10 +122,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("coupons", params.getPathParam(0), "archive") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -155,10 +155,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("coupons", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 3d8d45679..6b10b0a86 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 @@ -40,10 +40,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("credit_notes") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -75,10 +75,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("credit_notes") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -108,10 +108,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("credit_notes", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 5c98516fe..7a7ae7621 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 @@ -75,10 +75,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("customers") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -110,10 +110,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("customers", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -147,10 +147,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -189,10 +189,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.DELETE) .addPathSegments("customers", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -219,10 +219,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -254,10 +254,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", "external_customer_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -287,10 +287,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("customers", "external_customer_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response 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 87e82fc8a..509c5c863 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 @@ -93,10 +93,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("events", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -158,10 +158,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("events", params.getPathParam(0), "deprecate") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -377,10 +377,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("ingest") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -422,10 +422,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("events", "search") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response 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 0eee7da71..091d58724 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 @@ -39,10 +39,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("invoice_line_items") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response 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 edbfcfe56..3629cc94d 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 @@ -44,10 +44,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("invoices") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -79,10 +79,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("invoices", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -123,10 +123,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("invoices") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -156,10 +156,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("invoices", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -189,10 +189,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("invoices", "upcoming") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -224,10 +224,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("invoices", params.getPathParam(0), "issue") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -257,10 +257,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("invoices", params.getPathParam(0), "mark_paid") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -294,10 +294,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("invoices", params.getPathParam(0), "void") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response 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 776291b79..145b5e75e 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 @@ -39,10 +39,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("items") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -69,10 +69,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("items", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -100,10 +100,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("items") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -130,10 +130,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("items", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 e74970a24..957af817b 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 @@ -43,10 +43,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("metrics") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -76,10 +76,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("metrics", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -111,10 +111,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("metrics") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -144,10 +144,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("metrics", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 d31c76158..b39c0f41d 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 @@ -47,10 +47,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("plans") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -82,10 +82,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("plans", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -118,10 +118,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("plans") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -165,10 +165,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("plans", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 87e3c06ca..f7308417f 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 @@ -59,10 +59,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("prices") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -92,10 +92,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("prices", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -126,10 +126,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("prices") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -174,10 +174,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("prices", params.getPathParam(0), "evaluate") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -204,10 +204,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("prices", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 6046f6bde..86b47aa9a 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 @@ -299,10 +299,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -332,10 +332,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("subscriptions", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -372,10 +372,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("subscriptions") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -456,10 +456,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions", params.getPathParam(0), "cancel") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -489,10 +489,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("subscriptions", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -529,10 +529,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("subscriptions", params.getPathParam(0), "costs") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -563,10 +563,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("subscriptions", params.getPathParam(0), "schedule") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -769,10 +769,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("subscriptions", params.getPathParam(0), "usage") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -865,10 +865,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions", params.getPathParam(0), "price_intervals") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -1058,10 +1058,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions", params.getPathParam(0), "schedule_plan_change") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -1091,10 +1091,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions", params.getPathParam(0), "trigger_phase") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -1128,10 +1128,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions", params.getPathParam(0), "unschedule_cancellation") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -1169,10 +1169,10 @@ constructor( params.getPathParam(0), "unschedule_fixed_fee_quantity_updates" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -1207,10 +1207,10 @@ constructor( params.getPathParam(0), "unschedule_pending_plan_changes" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -1255,10 +1255,10 @@ constructor( params.getPathParam(0), "update_fixed_fee_quantity" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -1303,10 +1303,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions", params.getPathParam(0), "update_trial") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response 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 44665757b..a7b61940a 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 @@ -41,10 +41,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("ping") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 af0857bac..f25048483 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 @@ -40,10 +40,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("coupons", params.getPathParam(0), "subscriptions") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 add62c478..ee733395e 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 @@ -41,10 +41,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("customers", params.getPathParam(0), "balance_transactions") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -98,10 +98,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", params.getPathParam(0), "balance_transactions") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 239568a37..a7141e16d 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 @@ -146,10 +146,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", params.getPathParam(0), "costs") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -290,10 +290,10 @@ constructor( params.getPathParam(0), "costs" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 a32aa38da..cee970b31 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 @@ -54,10 +54,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", params.getPathParam(0), "credits") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -95,10 +95,10 @@ constructor( params.getPathParam(0), "credits" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 5d9b923d9..6d0eb0214 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 @@ -120,10 +120,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", params.getPathParam(0), "credits", "ledger") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -253,10 +253,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("customers", params.getPathParam(0), "credits", "ledger_entry") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -393,10 +393,10 @@ constructor( "credits", "ledger_entry" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -511,10 +511,10 @@ constructor( "credits", "ledger" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 cf23ed28a..af1012be1 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 @@ -52,10 +52,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("customers", params.getPathParam(0), "credits", "top_ups") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -83,10 +83,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", params.getPathParam(0), "credits", "top_ups") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -118,10 +118,10 @@ constructor( "top_ups", params.getPathParam(1) ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -156,10 +156,10 @@ constructor( "credits", "top_ups" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -193,10 +193,10 @@ constructor( "top_ups", params.getPathParam(1) ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -225,10 +225,10 @@ constructor( "credits", "top_ups" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 40e4608db..b602db057 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 @@ -72,10 +72,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("events", "backfills") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -110,10 +110,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("events", "backfills") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -145,10 +145,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("events", "backfills", params.getPathParam(0), "close") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -176,10 +176,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("events", "backfills", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> @@ -213,10 +213,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("events", "backfills", params.getPathParam(0), "revert") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response 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 1bee16f5a..e21ec1b1b 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 @@ -46,10 +46,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("events", "volume") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 8d21034fb..b1f6c2b97 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 @@ -41,10 +41,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("plans", "external_plan_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -87,10 +87,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("plans", "external_plan_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 e5bd15e98..9787b10b0 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 @@ -39,10 +39,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("prices", "external_price_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response @@ -73,10 +73,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("prices", "external_price_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response -> 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 4b6b58566..12f6fca96 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 @@ -39,10 +39,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("alerts", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -64,10 +64,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("alerts", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -100,10 +100,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("alerts") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -137,10 +137,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("alerts", "customer_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -174,10 +174,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("alerts", "external_customer_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -214,10 +214,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("alerts", "subscription_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -240,10 +240,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("alerts", params.getPathParam(0), "disable") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -266,10 +266,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("alerts", params.getPathParam(0), "enable") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> 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 7d63fc8b1..4f461ed3f 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 @@ -46,10 +46,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("coupons") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -80,10 +80,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("coupons") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -110,10 +110,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("coupons", params.getPathParam(0), "archive") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -139,10 +139,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("coupons", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 eeeedffae..261384fce 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 @@ -39,10 +39,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("credit_notes") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -73,10 +73,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("credit_notes") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -102,10 +102,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("credit_notes", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 3fd672a76..442c2cc72 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 @@ -71,10 +71,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("customers") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -102,10 +102,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("customers", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -138,10 +138,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -176,10 +176,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.DELETE) .addPathSegments("customers", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -202,10 +202,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -236,10 +236,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", "external_customer_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -268,10 +268,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("customers", "external_customer_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> 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 af42e0fd5..c36545d9f 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 @@ -92,10 +92,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("events", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -156,10 +156,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("events", params.getPathParam(0), "deprecate") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -374,10 +374,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("ingest") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -418,10 +418,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("events", "search") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> 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 4bc8039b5..b37c8657f 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 @@ -38,10 +38,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("invoice_line_items") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> 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 e59693c97..8d2fe5687 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 @@ -40,10 +40,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("invoices") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -71,10 +71,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("invoices", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -111,10 +111,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("invoices") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -140,10 +140,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("invoices", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -172,10 +172,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("invoices", "upcoming") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -203,10 +203,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("invoices", params.getPathParam(0), "issue") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -232,10 +232,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("invoices", params.getPathParam(0), "mark_paid") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -268,10 +268,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("invoices", params.getPathParam(0), "void") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> 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 a11100afe..eb4c3cf38 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 @@ -35,10 +35,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("items") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -61,10 +61,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("items", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -87,10 +87,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("items") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -113,10 +113,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("items", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 29af629e6..d7f260084 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 @@ -42,10 +42,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("metrics") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -74,10 +74,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("metrics", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -105,10 +105,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("metrics") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -134,10 +134,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("metrics", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 513fa5235..6938ca975 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 @@ -43,10 +43,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("plans") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -74,10 +74,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("plans", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -105,10 +105,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("plans") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -148,10 +148,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("plans", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 7da5b3b00..5c69a2606 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 @@ -55,10 +55,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("prices") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -84,10 +84,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("prices", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -113,10 +113,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("prices") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -160,10 +160,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("prices", params.getPathParam(0), "evaluate") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -186,10 +186,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("prices", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 d5aefb46e..6b8e4e00b 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 @@ -298,10 +298,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -330,10 +330,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("subscriptions", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -369,10 +369,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("subscriptions") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -452,10 +452,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions", params.getPathParam(0), "cancel") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -484,10 +484,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("subscriptions", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -523,10 +523,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("subscriptions", params.getPathParam(0), "costs") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -556,10 +556,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("subscriptions", params.getPathParam(0), "schedule") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -761,10 +761,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("subscriptions", params.getPathParam(0), "usage") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -856,10 +856,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions", params.getPathParam(0), "price_intervals") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -1048,10 +1048,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions", params.getPathParam(0), "schedule_plan_change") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -1080,10 +1080,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions", params.getPathParam(0), "trigger_phase") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -1116,10 +1116,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions", params.getPathParam(0), "unschedule_cancellation") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -1156,10 +1156,10 @@ constructor( params.getPathParam(0), "unschedule_fixed_fee_quantity_updates" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -1193,10 +1193,10 @@ constructor( params.getPathParam(0), "unschedule_pending_plan_changes" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -1240,10 +1240,10 @@ constructor( params.getPathParam(0), "update_fixed_fee_quantity" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -1287,10 +1287,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("subscriptions", params.getPathParam(0), "update_trial") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> 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 402c448cc..c52dc8989 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 @@ -40,10 +40,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("ping") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 8738a0277..ccaf22f1d 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 @@ -39,10 +39,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("coupons", params.getPathParam(0), "subscriptions") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 938fa3c87..d5b0ddebc 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 @@ -40,10 +40,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("customers", params.getPathParam(0), "balance_transactions") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -96,10 +96,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", params.getPathParam(0), "balance_transactions") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 bb009dad8..250e44469 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 @@ -145,10 +145,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", params.getPathParam(0), "costs") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -288,10 +288,10 @@ constructor( params.getPathParam(0), "costs" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 34ac15c2b..9a36bbf50 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 @@ -53,10 +53,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", params.getPathParam(0), "credits") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -93,10 +93,10 @@ constructor( params.getPathParam(0), "credits" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 b8bccbe37..2b23c7566 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 @@ -119,10 +119,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", params.getPathParam(0), "credits", "ledger") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -251,10 +251,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("customers", params.getPathParam(0), "credits", "ledger_entry") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -390,10 +390,10 @@ constructor( "credits", "ledger_entry" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -505,10 +505,10 @@ constructor( "credits", "ledger" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 696b58940..8045555d8 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 @@ -51,10 +51,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("customers", params.getPathParam(0), "credits", "top_ups") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -81,10 +81,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("customers", params.getPathParam(0), "credits", "top_ups") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -112,10 +112,10 @@ constructor( "top_ups", params.getPathParam(1) ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -149,10 +149,10 @@ constructor( "credits", "top_ups" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -185,10 +185,10 @@ constructor( "top_ups", params.getPathParam(1) ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -215,10 +215,10 @@ constructor( "credits", "top_ups" ) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 1163dc7c9..c33290b25 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 @@ -71,10 +71,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("events", "backfills") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -108,10 +108,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("events", "backfills") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -142,10 +142,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("events", "backfills", params.getPathParam(0), "close") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -172,10 +172,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("events", "backfills", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response @@ -208,10 +208,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("events", "backfills", params.getPathParam(0), "revert") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .apply { params.getBody().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> 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 bc276a5e8..2b0a5ee5c 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 @@ -42,10 +42,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("events", "volume") - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 1a1d3cb6f..60de2d4b6 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 @@ -40,10 +40,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("plans", "external_plan_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -85,10 +85,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("plans", "external_plan_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response 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 d52998ccd..dcae3fd66 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 @@ -38,10 +38,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.PUT) .addPathSegments("prices", "external_price_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .body(json(clientOptions.jsonMapper, params.getBody())) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> @@ -71,10 +71,10 @@ constructor( HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("prices", "external_price_id", params.getPathParam(0)) - .putAllQueryParams(clientOptions.queryParams) - .putAllQueryParams(params.getQueryParams()) - .putAllHeaders(clientOptions.headers) - .putAllHeaders(params.getHeaders()) + .putAllQueryParams(clientOptions.queryParams.asMap()) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers.asMap()) + .replaceAllHeaders(params.getHeaders()) .build() return clientOptions.httpClient.execute(request, requestOptions).let { response -> response From aeb1fed100a2ec3ab167b802d005238839ce16dd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 21:23:54 +0000 Subject: [PATCH 2/3] feat(api): api update (#103) --- .stats.yml | 2 +- .../withorb/api/models/PlanCreateParams.kt | 1194 ++- .../kotlin/com/withorb/api/models/Price.kt | 8670 ++++++++++------- .../withorb/api/models/PriceCreateParams.kt | 972 +- .../SubscriptionPriceIntervalsParams.kt | 1234 ++- 5 files changed, 8619 insertions(+), 3453 deletions(-) diff --git a/.stats.yml b/.stats.yml index 085568c25..3114caa32 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 96 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-5d22d9573f8fe12b31b2433b658b708f7cc379318d124afc74188afdc07e1ccc.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-1345a8e288e34d5477b0e189877225f83939a59078c22fbb5367712e376c5d19.yml 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 7dd876a4a..0d048e883 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 @@ -501,6 +501,7 @@ constructor( null, private val newPlanMatrixWithDisplayNamePrice: NewPlanMatrixWithDisplayNamePrice? = null, private val newPlanBulkWithProrationPrice: NewPlanBulkWithProrationPrice? = null, + private val newPlanGroupedTieredPackagePrice: NewPlanGroupedTieredPackagePrice? = null, private val _json: JsonValue? = null, ) { @@ -565,6 +566,9 @@ constructor( fun newPlanBulkWithProrationPrice(): Optional = Optional.ofNullable(newPlanBulkWithProrationPrice) + fun newPlanGroupedTieredPackagePrice(): Optional = + Optional.ofNullable(newPlanGroupedTieredPackagePrice) + fun isNewPlanUnitPrice(): Boolean = newPlanUnitPrice != null fun isNewPlanPackagePrice(): Boolean = newPlanPackagePrice != null @@ -609,6 +613,8 @@ constructor( fun isNewPlanBulkWithProrationPrice(): Boolean = newPlanBulkWithProrationPrice != null + fun isNewPlanGroupedTieredPackagePrice(): Boolean = newPlanGroupedTieredPackagePrice != null + fun asNewPlanUnitPrice(): NewPlanUnitPrice = newPlanUnitPrice.getOrThrow("newPlanUnitPrice") fun asNewPlanPackagePrice(): NewPlanPackagePrice = @@ -670,6 +676,9 @@ constructor( fun asNewPlanBulkWithProrationPrice(): NewPlanBulkWithProrationPrice = newPlanBulkWithProrationPrice.getOrThrow("newPlanBulkWithProrationPrice") + fun asNewPlanGroupedTieredPackagePrice(): NewPlanGroupedTieredPackagePrice = + newPlanGroupedTieredPackagePrice.getOrThrow("newPlanGroupedTieredPackagePrice") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T { @@ -715,6 +724,8 @@ constructor( ) newPlanBulkWithProrationPrice != null -> visitor.visitNewPlanBulkWithProrationPrice(newPlanBulkWithProrationPrice) + newPlanGroupedTieredPackagePrice != null -> + visitor.visitNewPlanGroupedTieredPackagePrice(newPlanGroupedTieredPackagePrice) else -> visitor.unknown(_json) } } @@ -741,7 +752,8 @@ constructor( newPlanGroupedWithProratedMinimumPrice == null && newPlanGroupedWithMeteredMinimumPrice == null && newPlanMatrixWithDisplayNamePrice == null && - newPlanBulkWithProrationPrice == null + newPlanBulkWithProrationPrice == null && + newPlanGroupedTieredPackagePrice == null ) { throw OrbInvalidDataException("Unknown Price: $_json") } @@ -765,6 +777,7 @@ constructor( newPlanGroupedWithMeteredMinimumPrice?.validate() newPlanMatrixWithDisplayNamePrice?.validate() newPlanBulkWithProrationPrice?.validate() + newPlanGroupedTieredPackagePrice?.validate() validated = true } } @@ -774,11 +787,11 @@ constructor( return true } - return /* spotless:off */ other is Price && this.newPlanUnitPrice == other.newPlanUnitPrice && this.newPlanPackagePrice == other.newPlanPackagePrice && this.newPlanMatrixPrice == other.newPlanMatrixPrice && this.newPlanTieredPrice == other.newPlanTieredPrice && this.newPlanTieredBpsPrice == other.newPlanTieredBpsPrice && this.newPlanBpsPrice == other.newPlanBpsPrice && this.newPlanBulkBpsPrice == other.newPlanBulkBpsPrice && this.newPlanBulkPrice == other.newPlanBulkPrice && this.newPlanThresholdTotalAmountPrice == other.newPlanThresholdTotalAmountPrice && this.newPlanTieredPackagePrice == other.newPlanTieredPackagePrice && this.newPlanTieredWithMinimumPrice == other.newPlanTieredWithMinimumPrice && this.newPlanUnitWithPercentPrice == other.newPlanUnitWithPercentPrice && this.newPlanPackageWithAllocationPrice == other.newPlanPackageWithAllocationPrice && this.newPlanTierWithProrationPrice == other.newPlanTierWithProrationPrice && this.newPlanUnitWithProrationPrice == other.newPlanUnitWithProrationPrice && this.newPlanGroupedAllocationPrice == other.newPlanGroupedAllocationPrice && this.newPlanGroupedWithProratedMinimumPrice == other.newPlanGroupedWithProratedMinimumPrice && this.newPlanGroupedWithMeteredMinimumPrice == other.newPlanGroupedWithMeteredMinimumPrice && this.newPlanMatrixWithDisplayNamePrice == other.newPlanMatrixWithDisplayNamePrice && this.newPlanBulkWithProrationPrice == other.newPlanBulkWithProrationPrice /* spotless:on */ + return /* spotless:off */ other is Price && this.newPlanUnitPrice == other.newPlanUnitPrice && this.newPlanPackagePrice == other.newPlanPackagePrice && this.newPlanMatrixPrice == other.newPlanMatrixPrice && this.newPlanTieredPrice == other.newPlanTieredPrice && this.newPlanTieredBpsPrice == other.newPlanTieredBpsPrice && this.newPlanBpsPrice == other.newPlanBpsPrice && this.newPlanBulkBpsPrice == other.newPlanBulkBpsPrice && this.newPlanBulkPrice == other.newPlanBulkPrice && this.newPlanThresholdTotalAmountPrice == other.newPlanThresholdTotalAmountPrice && this.newPlanTieredPackagePrice == other.newPlanTieredPackagePrice && this.newPlanTieredWithMinimumPrice == other.newPlanTieredWithMinimumPrice && this.newPlanUnitWithPercentPrice == other.newPlanUnitWithPercentPrice && this.newPlanPackageWithAllocationPrice == other.newPlanPackageWithAllocationPrice && this.newPlanTierWithProrationPrice == other.newPlanTierWithProrationPrice && this.newPlanUnitWithProrationPrice == other.newPlanUnitWithProrationPrice && this.newPlanGroupedAllocationPrice == other.newPlanGroupedAllocationPrice && this.newPlanGroupedWithProratedMinimumPrice == other.newPlanGroupedWithProratedMinimumPrice && this.newPlanGroupedWithMeteredMinimumPrice == other.newPlanGroupedWithMeteredMinimumPrice && this.newPlanMatrixWithDisplayNamePrice == other.newPlanMatrixWithDisplayNamePrice && this.newPlanBulkWithProrationPrice == other.newPlanBulkWithProrationPrice && this.newPlanGroupedTieredPackagePrice == other.newPlanGroupedTieredPackagePrice /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(newPlanUnitPrice, newPlanPackagePrice, newPlanMatrixPrice, newPlanTieredPrice, newPlanTieredBpsPrice, newPlanBpsPrice, newPlanBulkBpsPrice, newPlanBulkPrice, newPlanThresholdTotalAmountPrice, newPlanTieredPackagePrice, newPlanTieredWithMinimumPrice, newPlanUnitWithPercentPrice, newPlanPackageWithAllocationPrice, newPlanTierWithProrationPrice, newPlanUnitWithProrationPrice, newPlanGroupedAllocationPrice, newPlanGroupedWithProratedMinimumPrice, newPlanGroupedWithMeteredMinimumPrice, newPlanMatrixWithDisplayNamePrice, newPlanBulkWithProrationPrice) /* spotless:on */ + return /* spotless:off */ Objects.hash(newPlanUnitPrice, newPlanPackagePrice, newPlanMatrixPrice, newPlanTieredPrice, newPlanTieredBpsPrice, newPlanBpsPrice, newPlanBulkBpsPrice, newPlanBulkPrice, newPlanThresholdTotalAmountPrice, newPlanTieredPackagePrice, newPlanTieredWithMinimumPrice, newPlanUnitWithPercentPrice, newPlanPackageWithAllocationPrice, newPlanTierWithProrationPrice, newPlanUnitWithProrationPrice, newPlanGroupedAllocationPrice, newPlanGroupedWithProratedMinimumPrice, newPlanGroupedWithMeteredMinimumPrice, newPlanMatrixWithDisplayNamePrice, newPlanBulkWithProrationPrice, newPlanGroupedTieredPackagePrice) /* spotless:on */ } override fun toString(): String { @@ -816,6 +829,8 @@ constructor( "Price{newPlanMatrixWithDisplayNamePrice=$newPlanMatrixWithDisplayNamePrice}" newPlanBulkWithProrationPrice != null -> "Price{newPlanBulkWithProrationPrice=$newPlanBulkWithProrationPrice}" + newPlanGroupedTieredPackagePrice != null -> + "Price{newPlanGroupedTieredPackagePrice=$newPlanGroupedTieredPackagePrice}" _json != null -> "Price{_unknown=$_json}" else -> throw IllegalStateException("Invalid Price") } @@ -916,6 +931,11 @@ constructor( fun ofNewPlanBulkWithProrationPrice( newPlanBulkWithProrationPrice: NewPlanBulkWithProrationPrice ) = Price(newPlanBulkWithProrationPrice = newPlanBulkWithProrationPrice) + + @JvmStatic + fun ofNewPlanGroupedTieredPackagePrice( + newPlanGroupedTieredPackagePrice: NewPlanGroupedTieredPackagePrice + ) = Price(newPlanGroupedTieredPackagePrice = newPlanGroupedTieredPackagePrice) } interface Visitor { @@ -984,6 +1004,10 @@ constructor( newPlanBulkWithProrationPrice: NewPlanBulkWithProrationPrice ): T + fun visitNewPlanGroupedTieredPackagePrice( + newPlanGroupedTieredPackagePrice: NewPlanGroupedTieredPackagePrice + ): T + fun unknown(json: JsonValue?): T { throw OrbInvalidDataException("Unknown Price: $json") } @@ -1159,6 +1183,14 @@ constructor( return Price(newPlanBulkWithProrationPrice = it, _json = json) } } + "grouped_tiered_package" -> { + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Price(newPlanGroupedTieredPackagePrice = it, _json = json) + } + } } return Price(_json = json) @@ -1210,6 +1242,8 @@ constructor( generator.writeObject(value.newPlanMatrixWithDisplayNamePrice) value.newPlanBulkWithProrationPrice != null -> generator.writeObject(value.newPlanBulkWithProrationPrice) + value.newPlanGroupedTieredPackagePrice != null -> + generator.writeObject(value.newPlanGroupedTieredPackagePrice) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Price") } @@ -25236,6 +25270,1160 @@ constructor( override fun toString() = "NewPlanBulkWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkWithProrationConfig=$bulkWithProrationConfig, currency=$currency, additionalProperties=$additionalProperties}" } + + @JsonDeserialize(builder = NewPlanGroupedTieredPackagePrice.Builder::class) + @NoAutoDetect + class NewPlanGroupedTieredPackagePrice + private constructor( + private val metadata: JsonField, + private val externalPriceId: JsonField, + private val name: JsonField, + private val billableMetricId: JsonField, + private val itemId: JsonField, + private val billedInAdvance: JsonField, + private val fixedPriceQuantity: JsonField, + private val invoiceGroupingKey: JsonField, + private val cadence: JsonField, + private val billingCycleConfiguration: JsonField, + private val invoicingCycleConfiguration: JsonField, + private val conversionRate: JsonField, + private val modelType: JsonField, + private val groupedTieredPackageConfig: JsonField, + private val currency: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + + /** The name of the price. */ + fun name(): String = name.getRequired("name") + + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) + + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + + fun modelType(): ModelType = modelType.getRequired("model_type") + + fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = + groupedTieredPackageConfig.getRequired("grouped_tiered_package_config") + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId() = externalPriceId + + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId() = billableMetricId + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance() = billedInAdvance + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity() = fixedPriceQuantity + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey() = invoiceGroupingKey + + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration() = billingCycleConfiguration + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + + @JsonProperty("grouped_tiered_package_config") + @ExcludeMissing + fun _groupedTieredPackageConfig() = groupedTieredPackageConfig + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this price + * is billed. + */ + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): NewPlanGroupedTieredPackagePrice = apply { + if (!validated) { + metadata().map { it.validate() } + externalPriceId() + name() + billableMetricId() + itemId() + billedInAdvance() + fixedPriceQuantity() + invoiceGroupingKey() + cadence() + billingCycleConfiguration().map { it.validate() } + invoicingCycleConfiguration().map { it.validate() } + conversionRate() + modelType() + groupedTieredPackageConfig().validate() + currency() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var metadata: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var billableMetricId: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var groupedTieredPackageConfig: JsonField = + JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + newPlanGroupedTieredPackagePrice: NewPlanGroupedTieredPackagePrice + ) = apply { + this.metadata = newPlanGroupedTieredPackagePrice.metadata + this.externalPriceId = newPlanGroupedTieredPackagePrice.externalPriceId + this.name = newPlanGroupedTieredPackagePrice.name + this.billableMetricId = newPlanGroupedTieredPackagePrice.billableMetricId + this.itemId = newPlanGroupedTieredPackagePrice.itemId + this.billedInAdvance = newPlanGroupedTieredPackagePrice.billedInAdvance + this.fixedPriceQuantity = newPlanGroupedTieredPackagePrice.fixedPriceQuantity + this.invoiceGroupingKey = newPlanGroupedTieredPackagePrice.invoiceGroupingKey + this.cadence = newPlanGroupedTieredPackagePrice.cadence + this.billingCycleConfiguration = + newPlanGroupedTieredPackagePrice.billingCycleConfiguration + this.invoicingCycleConfiguration = + newPlanGroupedTieredPackagePrice.invoicingCycleConfiguration + this.conversionRate = newPlanGroupedTieredPackagePrice.conversionRate + this.modelType = newPlanGroupedTieredPackagePrice.modelType + this.groupedTieredPackageConfig = + newPlanGroupedTieredPackagePrice.groupedTieredPackageConfig + this.currency = newPlanGroupedTieredPackagePrice.currency + additionalProperties(newPlanGroupedTieredPackagePrice.additionalProperties) + } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } + + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String) = + billableMetricId(JsonField.of(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") + @ExcludeMissing + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(JsonField.of(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(JsonField.of(fixedPriceQuantity)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String) = + invoiceGroupingKey(JsonField.of(invoiceGroupingKey)) + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") + @ExcludeMissing + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration + ) = billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + @JsonProperty("model_type") + @ExcludeMissing + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } + + fun groupedTieredPackageConfig( + groupedTieredPackageConfig: GroupedTieredPackageConfig + ) = groupedTieredPackageConfig(JsonField.of(groupedTieredPackageConfig)) + + @JsonProperty("grouped_tiered_package_config") + @ExcludeMissing + fun groupedTieredPackageConfig( + groupedTieredPackageConfig: JsonField + ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + @JsonProperty("currency") + @ExcludeMissing + fun currency(currency: JsonField) = apply { this.currency = currency } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): NewPlanGroupedTieredPackagePrice = + NewPlanGroupedTieredPackagePrice( + metadata, + externalPriceId, + name, + billableMetricId, + itemId, + billedInAdvance, + fixedPriceQuantity, + invoiceGroupingKey, + cadence, + billingCycleConfiguration, + invoicingCycleConfiguration, + conversionRate, + modelType, + groupedTieredPackageConfig, + currency, + additionalProperties.toImmutable(), + ) + } + + class Cadence + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Cadence && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val ANNUAL = Cadence(JsonField.of("annual")) + + @JvmField val SEMI_ANNUAL = Cadence(JsonField.of("semi_annual")) + + @JvmField val MONTHLY = Cadence(JsonField.of("monthly")) + + @JvmField val QUARTERLY = Cadence(JsonField.of("quarterly")) + + @JvmField val ONE_TIME = Cadence(JsonField.of("one_time")) + + @JvmField val CUSTOM = Cadence(JsonField.of("custom")) + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } + + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } + + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = GroupedTieredPackageConfig.Builder::class) + @NoAutoDetect + class GroupedTieredPackageConfig + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): GroupedTieredPackageConfig = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(groupedTieredPackageConfig: GroupedTieredPackageConfig) = + apply { + additionalProperties(groupedTieredPackageConfig.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): GroupedTieredPackageConfig = + GroupedTieredPackageConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is GroupedTieredPackageConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" + } + + class ModelType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ModelType && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField + val GROUPED_TIERED_PACKAGE = ModelType(JsonField.of("grouped_tiered_package")) + + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } + + enum class Known { + GROUPED_TIERED_PACKAGE, + } + + enum class Value { + GROUPED_TIERED_PACKAGE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonDeserialize(builder = BillingCycleConfiguration.Builder::class) + @NoAutoDetect + class BillingCycleConfiguration + private constructor( + private val duration: JsonField, + private val durationUnit: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") @ExcludeMissing fun _duration() = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") @ExcludeMissing fun _durationUnit() = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): BillingCycleConfiguration = apply { + if (!validated) { + duration() + durationUnit() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField = JsonMissing.of() + private var durationUnit: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + this.duration = billingCycleConfiguration.duration + this.durationUnit = billingCycleConfiguration.durationUnit + additionalProperties(billingCycleConfiguration.additionalProperties) + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + duration, + durationUnit, + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val DAY = DurationUnit(JsonField.of("day")) + + @JvmField val MONTH = DurationUnit(JsonField.of("month")) + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BillingCycleConfiguration && this.duration == other.duration && this.durationUnit == other.durationUnit && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(duration, durationUnit, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonDeserialize(builder = InvoicingCycleConfiguration.Builder::class) + @NoAutoDetect + class InvoicingCycleConfiguration + private constructor( + private val duration: JsonField, + private val durationUnit: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") @ExcludeMissing fun _duration() = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") @ExcludeMissing fun _durationUnit() = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): InvoicingCycleConfiguration = apply { + if (!validated) { + duration() + durationUnit() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField = JsonMissing.of() + private var durationUnit: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + this.duration = invoicingCycleConfiguration.duration + this.durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties(invoicingCycleConfiguration.additionalProperties) + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + duration, + durationUnit, + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val DAY = DurationUnit(JsonField.of("day")) + + @JvmField val MONTH = DurationUnit(JsonField.of("month")) + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InvoicingCycleConfiguration && this.duration == other.duration && this.durationUnit == other.durationUnit && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(duration, durationUnit, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonDeserialize(builder = Metadata.Builder::class) + @NoAutoDetect + class Metadata + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Metadata = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties(metadata.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is NewPlanGroupedTieredPackagePrice && this.metadata == other.metadata && this.externalPriceId == other.externalPriceId && this.name == other.name && this.billableMetricId == other.billableMetricId && this.itemId == other.itemId && this.billedInAdvance == other.billedInAdvance && this.fixedPriceQuantity == other.fixedPriceQuantity && this.invoiceGroupingKey == other.invoiceGroupingKey && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.conversionRate == other.conversionRate && this.modelType == other.modelType && this.groupedTieredPackageConfig == other.groupedTieredPackageConfig && this.currency == other.currency && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedTieredPackageConfig, currency, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "NewPlanGroupedTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedTieredPackageConfig=$groupedTieredPackageConfig, currency=$currency, additionalProperties=$additionalProperties}" + } } /** 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 8232fcd6f..d1ba360dc 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 @@ -56,6 +56,7 @@ private constructor( private val groupedWithMeteredMinimumPrice: GroupedWithMeteredMinimumPrice? = null, private val matrixWithDisplayNamePrice: MatrixWithDisplayNamePrice? = null, private val bulkWithProrationPrice: BulkWithProrationPrice? = null, + private val groupedTieredPackagePrice: GroupedTieredPackagePrice? = null, private val _json: JsonValue? = null, ) { @@ -120,6 +121,9 @@ private constructor( fun bulkWithProrationPrice(): Optional = Optional.ofNullable(bulkWithProrationPrice) + fun groupedTieredPackagePrice(): Optional = + Optional.ofNullable(groupedTieredPackagePrice) + fun isUnitPrice(): Boolean = unitPrice != null fun isPackagePrice(): Boolean = packagePrice != null @@ -166,6 +170,8 @@ private constructor( fun isBulkWithProrationPrice(): Boolean = bulkWithProrationPrice != null + fun isGroupedTieredPackagePrice(): Boolean = groupedTieredPackagePrice != null + fun asUnitPrice(): UnitPrice = unitPrice.getOrThrow("unitPrice") fun asPackagePrice(): PackagePrice = packagePrice.getOrThrow("packagePrice") @@ -227,6 +233,9 @@ private constructor( fun asBulkWithProrationPrice(): BulkWithProrationPrice = bulkWithProrationPrice.getOrThrow("bulkWithProrationPrice") + fun asGroupedTieredPackagePrice(): GroupedTieredPackagePrice = + groupedTieredPackagePrice.getOrThrow("groupedTieredPackagePrice") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T { @@ -266,6 +275,8 @@ private constructor( visitor.visitMatrixWithDisplayNamePrice(matrixWithDisplayNamePrice) bulkWithProrationPrice != null -> visitor.visitBulkWithProrationPrice(bulkWithProrationPrice) + groupedTieredPackagePrice != null -> + visitor.visitGroupedTieredPackagePrice(groupedTieredPackagePrice) else -> visitor.unknown(_json) } } @@ -295,7 +306,8 @@ private constructor( groupedWithProratedMinimumPrice == null && groupedWithMeteredMinimumPrice == null && matrixWithDisplayNamePrice == null && - bulkWithProrationPrice == null + bulkWithProrationPrice == null && + groupedTieredPackagePrice == null ) { throw OrbInvalidDataException("Unknown Price: $_json") } @@ -322,6 +334,7 @@ private constructor( groupedWithMeteredMinimumPrice?.validate() matrixWithDisplayNamePrice?.validate() bulkWithProrationPrice?.validate() + groupedTieredPackagePrice?.validate() validated = true } } @@ -331,11 +344,11 @@ private constructor( return true } - return /* spotless:off */ other is Price && this.unitPrice == other.unitPrice && this.packagePrice == other.packagePrice && this.matrixPrice == other.matrixPrice && this.tieredPrice == other.tieredPrice && this.tieredBpsPrice == other.tieredBpsPrice && this.bpsPrice == other.bpsPrice && this.bulkBpsPrice == other.bulkBpsPrice && this.bulkPrice == other.bulkPrice && this.thresholdTotalAmountPrice == other.thresholdTotalAmountPrice && this.tieredPackagePrice == other.tieredPackagePrice && this.groupedTieredPrice == other.groupedTieredPrice && this.tieredWithMinimumPrice == other.tieredWithMinimumPrice && this.tieredPackageWithMinimumPrice == other.tieredPackageWithMinimumPrice && this.packageWithAllocationPrice == other.packageWithAllocationPrice && this.unitWithPercentPrice == other.unitWithPercentPrice && this.matrixWithAllocationPrice == other.matrixWithAllocationPrice && this.tieredWithProrationPrice == other.tieredWithProrationPrice && this.unitWithProrationPrice == other.unitWithProrationPrice && this.groupedAllocationPrice == other.groupedAllocationPrice && this.groupedWithProratedMinimumPrice == other.groupedWithProratedMinimumPrice && this.groupedWithMeteredMinimumPrice == other.groupedWithMeteredMinimumPrice && this.matrixWithDisplayNamePrice == other.matrixWithDisplayNamePrice && this.bulkWithProrationPrice == other.bulkWithProrationPrice /* spotless:on */ + return /* spotless:off */ other is Price && this.unitPrice == other.unitPrice && this.packagePrice == other.packagePrice && this.matrixPrice == other.matrixPrice && this.tieredPrice == other.tieredPrice && this.tieredBpsPrice == other.tieredBpsPrice && this.bpsPrice == other.bpsPrice && this.bulkBpsPrice == other.bulkBpsPrice && this.bulkPrice == other.bulkPrice && this.thresholdTotalAmountPrice == other.thresholdTotalAmountPrice && this.tieredPackagePrice == other.tieredPackagePrice && this.groupedTieredPrice == other.groupedTieredPrice && this.tieredWithMinimumPrice == other.tieredWithMinimumPrice && this.tieredPackageWithMinimumPrice == other.tieredPackageWithMinimumPrice && this.packageWithAllocationPrice == other.packageWithAllocationPrice && this.unitWithPercentPrice == other.unitWithPercentPrice && this.matrixWithAllocationPrice == other.matrixWithAllocationPrice && this.tieredWithProrationPrice == other.tieredWithProrationPrice && this.unitWithProrationPrice == other.unitWithProrationPrice && this.groupedAllocationPrice == other.groupedAllocationPrice && this.groupedWithProratedMinimumPrice == other.groupedWithProratedMinimumPrice && this.groupedWithMeteredMinimumPrice == other.groupedWithMeteredMinimumPrice && this.matrixWithDisplayNamePrice == other.matrixWithDisplayNamePrice && this.bulkWithProrationPrice == other.bulkWithProrationPrice && this.groupedTieredPackagePrice == other.groupedTieredPackagePrice /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(unitPrice, packagePrice, matrixPrice, tieredPrice, tieredBpsPrice, bpsPrice, bulkBpsPrice, bulkPrice, thresholdTotalAmountPrice, tieredPackagePrice, groupedTieredPrice, tieredWithMinimumPrice, tieredPackageWithMinimumPrice, packageWithAllocationPrice, unitWithPercentPrice, matrixWithAllocationPrice, tieredWithProrationPrice, unitWithProrationPrice, groupedAllocationPrice, groupedWithProratedMinimumPrice, groupedWithMeteredMinimumPrice, matrixWithDisplayNamePrice, bulkWithProrationPrice) /* spotless:on */ + return /* spotless:off */ Objects.hash(unitPrice, packagePrice, matrixPrice, tieredPrice, tieredBpsPrice, bpsPrice, bulkBpsPrice, bulkPrice, thresholdTotalAmountPrice, tieredPackagePrice, groupedTieredPrice, tieredWithMinimumPrice, tieredPackageWithMinimumPrice, packageWithAllocationPrice, unitWithPercentPrice, matrixWithAllocationPrice, tieredWithProrationPrice, unitWithProrationPrice, groupedAllocationPrice, groupedWithProratedMinimumPrice, groupedWithMeteredMinimumPrice, matrixWithDisplayNamePrice, bulkWithProrationPrice, groupedTieredPackagePrice) /* spotless:on */ } override fun toString(): String { @@ -375,6 +388,8 @@ private constructor( "Price{matrixWithDisplayNamePrice=$matrixWithDisplayNamePrice}" bulkWithProrationPrice != null -> "Price{bulkWithProrationPrice=$bulkWithProrationPrice}" + groupedTieredPackagePrice != null -> + "Price{groupedTieredPackagePrice=$groupedTieredPackagePrice}" _json != null -> "Price{_unknown=$_json}" else -> throw IllegalStateException("Invalid Price") } @@ -464,6 +479,10 @@ private constructor( @JvmStatic fun ofBulkWithProrationPrice(bulkWithProrationPrice: BulkWithProrationPrice) = Price(bulkWithProrationPrice = bulkWithProrationPrice) + + @JvmStatic + fun ofGroupedTieredPackagePrice(groupedTieredPackagePrice: GroupedTieredPackagePrice) = + Price(groupedTieredPackagePrice = groupedTieredPackagePrice) } interface Visitor { @@ -524,6 +543,8 @@ private constructor( fun visitBulkWithProrationPrice(bulkWithProrationPrice: BulkWithProrationPrice): T + fun visitGroupedTieredPackagePrice(groupedTieredPackagePrice: GroupedTieredPackagePrice): T + fun unknown(json: JsonValue?): T { throw OrbInvalidDataException("Unknown Price: $json") } @@ -690,6 +711,14 @@ private constructor( return Price(bulkWithProrationPrice = it, _json = json) } } + "grouped_tiered_package" -> { + tryDeserialize(node, jacksonTypeRef()) { + it.validate() + } + ?.let { + return Price(groupedTieredPackagePrice = it, _json = json) + } + } } return Price(_json = json) @@ -740,6 +769,8 @@ private constructor( generator.writeObject(value.matrixWithDisplayNamePrice) value.bulkWithProrationPrice != null -> generator.writeObject(value.bulkWithProrationPrice) + value.groupedTieredPackagePrice != null -> + generator.writeObject(value.groupedTieredPackagePrice) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Price") } @@ -2313,115 +2344,1841 @@ private constructor( companion object { - @JvmField val UNIT = ModelType(JsonField.of("unit")) + @JvmField val UNIT = ModelType(JsonField.of("unit")) + + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } + + enum class Known { + UNIT, + } + + enum class Value { + UNIT, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + UNIT -> Value.UNIT + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + UNIT -> Known.UNIT + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class PriceType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is PriceType && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val USAGE_PRICE = PriceType(JsonField.of("usage_price")) + + @JvmField val FIXED_PRICE = PriceType(JsonField.of("fixed_price")) + + @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) + } + + enum class Known { + USAGE_PRICE, + FIXED_PRICE, + } + + enum class Value { + USAGE_PRICE, + FIXED_PRICE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + USAGE_PRICE -> Value.USAGE_PRICE + FIXED_PRICE -> Value.FIXED_PRICE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + USAGE_PRICE -> Known.USAGE_PRICE + FIXED_PRICE -> Known.FIXED_PRICE + else -> throw OrbInvalidDataException("Unknown PriceType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = UnitConfig.Builder::class) + @NoAutoDetect + class UnitConfig + private constructor( + private val unitAmount: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** Rate per unit of usage */ + fun unitAmount(): String = unitAmount.getRequired("unit_amount") + + /** Rate per unit of usage */ + @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): UnitConfig = apply { + if (!validated) { + unitAmount() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var unitAmount: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(unitConfig: UnitConfig) = apply { + this.unitAmount = unitConfig.unitAmount + additionalProperties(unitConfig.additionalProperties) + } + + /** Rate per unit of usage */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) + + /** Rate per unit of usage */ + @JsonProperty("unit_amount") + @ExcludeMissing + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): UnitConfig = UnitConfig(unitAmount, additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is UnitConfig && this.unitAmount == other.unitAmount && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(unitAmount, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "UnitConfig{unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is UnitPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.unitConfig == other.unitConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, unitConfig, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "UnitPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, unitConfig=$unitConfig, additionalProperties=$additionalProperties}" + } + + @JsonDeserialize(builder = PackagePrice.Builder::class) + @NoAutoDetect + class PackagePrice + private constructor( + private val metadata: JsonField, + private val id: JsonField, + private val name: JsonField, + private val externalPriceId: JsonField, + private val priceType: JsonField, + private val modelType: JsonField, + private val createdAt: JsonField, + private val cadence: JsonField, + private val billingCycleConfiguration: JsonField, + private val invoicingCycleConfiguration: JsonField, + private val billableMetric: JsonField, + private val fixedPriceQuantity: JsonField, + private val planPhaseOrder: JsonField, + private val currency: JsonField, + private val conversionRate: JsonField, + private val item: JsonField, + private val creditAllocation: JsonField, + private val discount: JsonField, + private val minimum: JsonField, + private val minimumAmount: JsonField, + private val maximum: JsonField, + private val maximumAmount: JsonField, + private val packageConfig: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** + * User specified key-value pairs for the resource. If not present, this defaults to an + * empty dictionary. Individual keys can be removed by setting the value to `null`, and the + * entire metadata mapping can be cleared by setting `metadata` to `null`. + */ + fun metadata(): Metadata = metadata.getRequired("metadata") + + fun id(): String = id.getRequired("id") + + fun name(): String = name.getRequired("name") + + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + + fun priceType(): PriceType = priceType.getRequired("price_type") + + fun modelType(): ModelType = modelType.getRequired("model_type") + + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + fun cadence(): Cadence = cadence.getRequired("cadence") + + fun billingCycleConfiguration(): BillingCycleConfiguration = + billingCycleConfiguration.getRequired("billing_cycle_configuration") + + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + fun billableMetric(): Optional = + Optional.ofNullable(billableMetric.getNullable("billable_metric")) + + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + fun planPhaseOrder(): Optional = + Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order")) + + fun currency(): String = currency.getRequired("currency") + + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + + fun item(): Item = item.getRequired("item") + + fun creditAllocation(): Optional = + Optional.ofNullable(creditAllocation.getNullable("credit_allocation")) + + fun discount(): Optional = Optional.ofNullable(discount.getNullable("discount")) + + fun minimum(): Optional = Optional.ofNullable(minimum.getNullable("minimum")) + + fun minimumAmount(): Optional = + Optional.ofNullable(minimumAmount.getNullable("minimum_amount")) + + fun maximum(): Optional = Optional.ofNullable(maximum.getNullable("maximum")) + + fun maximumAmount(): Optional = + Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) + + fun packageConfig(): PackageConfig = packageConfig.getRequired("package_config") + + /** + * User specified key-value pairs for the resource. If not present, this defaults to an + * empty dictionary. Individual keys can be removed by setting the value to `null`, and the + * entire metadata mapping can be cleared by setting `metadata` to `null`. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("external_price_id") @ExcludeMissing fun _externalPriceId() = externalPriceId + + @JsonProperty("price_type") @ExcludeMissing fun _priceType() = priceType + + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + + @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration() = billingCycleConfiguration + + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + + @JsonProperty("billable_metric") @ExcludeMissing fun _billableMetric() = billableMetric + + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity() = fixedPriceQuantity + + @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate + + @JsonProperty("item") @ExcludeMissing fun _item() = item + + @JsonProperty("credit_allocation") + @ExcludeMissing + fun _creditAllocation() = creditAllocation + + @JsonProperty("discount") @ExcludeMissing fun _discount() = discount + + @JsonProperty("minimum") @ExcludeMissing fun _minimum() = minimum + + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + + @JsonProperty("maximum") @ExcludeMissing fun _maximum() = maximum + + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + @JsonProperty("package_config") @ExcludeMissing fun _packageConfig() = packageConfig + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): PackagePrice = apply { + if (!validated) { + metadata().validate() + id() + name() + externalPriceId() + priceType() + modelType() + createdAt() + cadence() + billingCycleConfiguration().validate() + invoicingCycleConfiguration().map { it.validate() } + billableMetric().map { it.validate() } + fixedPriceQuantity() + planPhaseOrder() + currency() + conversionRate() + item().validate() + creditAllocation().map { it.validate() } + discount() + minimum().map { it.validate() } + minimumAmount() + maximum().map { it.validate() } + maximumAmount() + packageConfig().validate() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var metadata: JsonField = JsonMissing.of() + private var id: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var priceType: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var invoicingCycleConfiguration: JsonField = + JsonMissing.of() + private var billableMetric: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var planPhaseOrder: JsonField = JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var item: JsonField = JsonMissing.of() + private var creditAllocation: JsonField = JsonMissing.of() + private var discount: JsonField = JsonMissing.of() + private var minimum: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var maximum: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() + private var packageConfig: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(packagePrice: PackagePrice) = apply { + this.metadata = packagePrice.metadata + this.id = packagePrice.id + this.name = packagePrice.name + this.externalPriceId = packagePrice.externalPriceId + this.priceType = packagePrice.priceType + this.modelType = packagePrice.modelType + this.createdAt = packagePrice.createdAt + this.cadence = packagePrice.cadence + this.billingCycleConfiguration = packagePrice.billingCycleConfiguration + this.invoicingCycleConfiguration = packagePrice.invoicingCycleConfiguration + this.billableMetric = packagePrice.billableMetric + this.fixedPriceQuantity = packagePrice.fixedPriceQuantity + this.planPhaseOrder = packagePrice.planPhaseOrder + this.currency = packagePrice.currency + this.conversionRate = packagePrice.conversionRate + this.item = packagePrice.item + this.creditAllocation = packagePrice.creditAllocation + this.discount = packagePrice.discount + this.minimum = packagePrice.minimum + this.minimumAmount = packagePrice.minimumAmount + this.maximum = packagePrice.maximum + this.maximumAmount = packagePrice.maximumAmount + this.packageConfig = packagePrice.packageConfig + additionalProperties(packagePrice.additionalProperties) + } + + /** + * User specified key-value pairs for the resource. If not present, this defaults to an + * empty dictionary. Individual keys can be removed by setting the value to `null`, and + * the entire metadata mapping can be cleared by setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + + /** + * User specified key-value pairs for the resource. If not present, this defaults to an + * empty dictionary. Individual keys can be removed by setting the value to `null`, and + * the entire metadata mapping can be cleared by setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + fun id(id: String) = id(JsonField.of(id)) + + @JsonProperty("id") + @ExcludeMissing + fun id(id: JsonField) = apply { this.id = id } + + fun name(name: String) = name(JsonField.of(name)) + + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) + + @JsonProperty("external_price_id") + @ExcludeMissing + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } + + fun priceType(priceType: PriceType) = priceType(JsonField.of(priceType)) + + @JsonProperty("price_type") + @ExcludeMissing + fun priceType(priceType: JsonField) = apply { this.priceType = priceType } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + @JsonProperty("model_type") + @ExcludeMissing + fun modelType(modelType: JsonField) = apply { this.modelType = modelType } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + @JsonProperty("created_at") + @ExcludeMissing + fun createdAt(createdAt: JsonField) = apply { + this.createdAt = createdAt + } + + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + @JsonProperty("cadence") + @ExcludeMissing + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + fun billableMetric(billableMetric: BillableMetric) = + billableMetric(JsonField.of(billableMetric)) + + @JsonProperty("billable_metric") + @ExcludeMissing + fun billableMetric(billableMetric: JsonField) = apply { + this.billableMetric = billableMetric + } + + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(JsonField.of(fixedPriceQuantity)) + + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + fun planPhaseOrder(planPhaseOrder: Long) = planPhaseOrder(JsonField.of(planPhaseOrder)) + + @JsonProperty("plan_phase_order") + @ExcludeMissing + fun planPhaseOrder(planPhaseOrder: JsonField) = apply { + this.planPhaseOrder = planPhaseOrder + } + + fun currency(currency: String) = currency(JsonField.of(currency)) + + @JsonProperty("currency") + @ExcludeMissing + fun currency(currency: JsonField) = apply { this.currency = currency } + + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) + + @JsonProperty("conversion_rate") + @ExcludeMissing + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } + + fun item(item: Item) = item(JsonField.of(item)) + + @JsonProperty("item") + @ExcludeMissing + fun item(item: JsonField) = apply { this.item = item } + + fun creditAllocation(creditAllocation: CreditAllocation) = + creditAllocation(JsonField.of(creditAllocation)) + + @JsonProperty("credit_allocation") + @ExcludeMissing + fun creditAllocation(creditAllocation: JsonField) = apply { + this.creditAllocation = creditAllocation + } + + fun discount(discount: Discount) = discount(JsonField.of(discount)) + + @JsonProperty("discount") + @ExcludeMissing + fun discount(discount: JsonField) = apply { this.discount = discount } + + fun minimum(minimum: Minimum) = minimum(JsonField.of(minimum)) + + @JsonProperty("minimum") + @ExcludeMissing + fun minimum(minimum: JsonField) = apply { this.minimum = minimum } + + fun minimumAmount(minimumAmount: String) = minimumAmount(JsonField.of(minimumAmount)) + + @JsonProperty("minimum_amount") + @ExcludeMissing + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + + fun maximum(maximum: Maximum) = maximum(JsonField.of(maximum)) + + @JsonProperty("maximum") + @ExcludeMissing + fun maximum(maximum: JsonField) = apply { this.maximum = maximum } + + fun maximumAmount(maximumAmount: String) = maximumAmount(JsonField.of(maximumAmount)) + + @JsonProperty("maximum_amount") + @ExcludeMissing + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + + fun packageConfig(packageConfig: PackageConfig) = + packageConfig(JsonField.of(packageConfig)) + + @JsonProperty("package_config") + @ExcludeMissing + fun packageConfig(packageConfig: JsonField) = apply { + this.packageConfig = packageConfig + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): PackagePrice = + PackagePrice( + metadata, + id, + name, + externalPriceId, + priceType, + modelType, + createdAt, + cadence, + billingCycleConfiguration, + invoicingCycleConfiguration, + billableMetric, + fixedPriceQuantity, + planPhaseOrder, + currency, + conversionRate, + item, + creditAllocation, + discount, + minimum, + minimumAmount, + maximum, + maximumAmount, + packageConfig, + additionalProperties.toImmutable(), + ) + } + + @JsonDeserialize(builder = BillableMetric.Builder::class) + @NoAutoDetect + class BillableMetric + private constructor( + private val id: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + fun id(): String = id.getRequired("id") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): BillableMetric = apply { + if (!validated) { + id() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(billableMetric: BillableMetric) = apply { + this.id = billableMetric.id + additionalProperties(billableMetric.additionalProperties) + } + + fun id(id: String) = id(JsonField.of(id)) + + @JsonProperty("id") + @ExcludeMissing + fun id(id: JsonField) = apply { this.id = id } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): BillableMetric = BillableMetric(id, additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BillableMetric && this.id == other.id && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "BillableMetric{id=$id, additionalProperties=$additionalProperties}" + } + + @JsonDeserialize(builder = BillingCycleConfiguration.Builder::class) + @NoAutoDetect + class BillingCycleConfiguration + private constructor( + private val duration: JsonField, + private val durationUnit: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + fun duration(): Long = duration.getRequired("duration") + + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + @JsonProperty("duration") @ExcludeMissing fun _duration() = duration + + @JsonProperty("duration_unit") @ExcludeMissing fun _durationUnit() = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): BillingCycleConfiguration = apply { + if (!validated) { + duration() + durationUnit() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField = JsonMissing.of() + private var durationUnit: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { + this.duration = billingCycleConfiguration.duration + this.durationUnit = billingCycleConfiguration.durationUnit + additionalProperties(billingCycleConfiguration.additionalProperties) + } + + fun duration(duration: Long) = duration(JsonField.of(duration)) + + @JsonProperty("duration") + @ExcludeMissing + fun duration(duration: JsonField) = apply { this.duration = duration } + + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + @JsonProperty("duration_unit") + @ExcludeMissing + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + duration, + durationUnit, + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val DAY = DurationUnit(JsonField.of("day")) + + @JvmField val MONTH = DurationUnit(JsonField.of("month")) + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BillingCycleConfiguration && this.duration == other.duration && this.durationUnit == other.durationUnit && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(duration, durationUnit, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + class Cadence + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Cadence && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val ONE_TIME = Cadence(JsonField.of("one_time")) + + @JvmField val MONTHLY = Cadence(JsonField.of("monthly")) + + @JvmField val QUARTERLY = Cadence(JsonField.of("quarterly")) + + @JvmField val SEMI_ANNUAL = Cadence(JsonField.of("semi_annual")) + + @JvmField val ANNUAL = Cadence(JsonField.of("annual")) + + @JvmField val CUSTOM = Cadence(JsonField.of("custom")) + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } + + enum class Known { + ONE_TIME, + MONTHLY, + QUARTERLY, + SEMI_ANNUAL, + ANNUAL, + CUSTOM, + } + + enum class Value { + ONE_TIME, + MONTHLY, + QUARTERLY, + SEMI_ANNUAL, + ANNUAL, + CUSTOM, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ONE_TIME -> Value.ONE_TIME + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + SEMI_ANNUAL -> Value.SEMI_ANNUAL + ANNUAL -> Value.ANNUAL + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ONE_TIME -> Known.ONE_TIME + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + SEMI_ANNUAL -> Known.SEMI_ANNUAL + ANNUAL -> Known.ANNUAL + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = CreditAllocation.Builder::class) + @NoAutoDetect + class CreditAllocation + private constructor( + private val currency: JsonField, + private val allowsRollover: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + fun currency(): String = currency.getRequired("currency") + + fun allowsRollover(): Boolean = allowsRollover.getRequired("allows_rollover") + + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonProperty("allows_rollover") @ExcludeMissing fun _allowsRollover() = allowsRollover + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): CreditAllocation = apply { + if (!validated) { + currency() + allowsRollover() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var currency: JsonField = JsonMissing.of() + private var allowsRollover: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(creditAllocation: CreditAllocation) = apply { + this.currency = creditAllocation.currency + this.allowsRollover = creditAllocation.allowsRollover + additionalProperties(creditAllocation.additionalProperties) + } + + fun currency(currency: String) = currency(JsonField.of(currency)) + + @JsonProperty("currency") + @ExcludeMissing + fun currency(currency: JsonField) = apply { this.currency = currency } + + fun allowsRollover(allowsRollover: Boolean) = + allowsRollover(JsonField.of(allowsRollover)) + + @JsonProperty("allows_rollover") + @ExcludeMissing + fun allowsRollover(allowsRollover: JsonField) = apply { + this.allowsRollover = allowsRollover + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): CreditAllocation = + CreditAllocation( + currency, + allowsRollover, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is CreditAllocation && this.currency == other.currency && this.allowsRollover == other.allowsRollover && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(currency, allowsRollover, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" + } + + @JsonDeserialize(builder = InvoicingCycleConfiguration.Builder::class) + @NoAutoDetect + class InvoicingCycleConfiguration + private constructor( + private val duration: JsonField, + private val durationUnit: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + fun duration(): Long = duration.getRequired("duration") + + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + @JsonProperty("duration") @ExcludeMissing fun _duration() = duration + + @JsonProperty("duration_unit") @ExcludeMissing fun _durationUnit() = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): InvoicingCycleConfiguration = apply { + if (!validated) { + duration() + durationUnit() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField = JsonMissing.of() + private var durationUnit: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + this.duration = invoicingCycleConfiguration.duration + this.durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties(invoicingCycleConfiguration.additionalProperties) + } + + fun duration(duration: Long) = duration(JsonField.of(duration)) + + @JsonProperty("duration") + @ExcludeMissing + fun duration(duration: JsonField) = apply { this.duration = duration } + + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + @JsonProperty("duration_unit") + @ExcludeMissing + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + duration, + durationUnit, + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val DAY = DurationUnit(JsonField.of("day")) + + @JvmField val MONTH = DurationUnit(JsonField.of("month")) + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InvoicingCycleConfiguration && this.duration == other.duration && this.durationUnit == other.durationUnit && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(duration, durationUnit, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + @JsonDeserialize(builder = Item.Builder::class) + @NoAutoDetect + class Item + private constructor( + private val id: JsonField, + private val name: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + fun id(): String = id.getRequired("id") + + fun name(): String = name.getRequired("name") + + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Item = apply { + if (!validated) { + id() + name() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + this.id = item.id + this.name = item.name + additionalProperties(item.additionalProperties) + } + + fun id(id: String) = id(JsonField.of(id)) + + @JsonProperty("id") + @ExcludeMissing + fun id(id: JsonField) = apply { this.id = id } + + fun name(name: String) = name(JsonField.of(name)) + + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Item = + Item( + id, + name, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Item && this.id == other.id && this.name == other.name && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(id, name, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" + } + + @JsonDeserialize(builder = Maximum.Builder::class) + @NoAutoDetect + class Maximum + private constructor( + private val maximumAmount: JsonField, + private val appliesToPriceIds: JsonField>, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** Maximum amount applied */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, + * this can be a subset of prices. + */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, + * this can be a subset of prices. + */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Maximum = apply { + if (!validated) { + maximumAmount() + appliesToPriceIds() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var maximumAmount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(maximum: Maximum) = apply { + this.maximumAmount = maximum.maximumAmount + this.appliesToPriceIds = maximum.appliesToPriceIds + additionalProperties(maximum.additionalProperties) + } + + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Maximum amount applied */ + @JsonProperty("maximum_amount") + @ExcludeMissing + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase + * maximums, this can be a subset of prices. + */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase + * maximums, this can be a subset of prices. + */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Maximum = + Maximum( + maximumAmount, + appliesToPriceIds.map { it.toImmutable() }, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Maximum && this.maximumAmount == other.maximumAmount && this.appliesToPriceIds == other.appliesToPriceIds && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + } + + /** + * User specified key-value pairs for the resource. If not present, this defaults to an + * empty dictionary. Individual keys can be removed by setting the value to `null`, and the + * entire metadata mapping can be cleared by setting `metadata` to `null`. + */ + @JsonDeserialize(builder = Metadata.Builder::class) + @NoAutoDetect + class Metadata + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Metadata = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties(metadata.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + @JsonDeserialize(builder = Minimum.Builder::class) + @NoAutoDetect + class Minimum + private constructor( + private val minimumAmount: JsonField, + private val appliesToPriceIds: JsonField>, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** Minimum amount applied */ + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") + + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, + * this can be a subset of prices. + */ + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") + + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, + * this can be a subset of prices. + */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Minimum = apply { + if (!validated) { + minimumAmount() + appliesToPriceIds() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var minimumAmount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(minimum: Minimum) = apply { + this.minimumAmount = minimum.minimumAmount + this.appliesToPriceIds = minimum.appliesToPriceIds + additionalProperties(minimum.additionalProperties) + } + + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) + + /** Minimum amount applied */ + @JsonProperty("minimum_amount") + @ExcludeMissing + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount + } + + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase + * minimums, this can be a subset of prices. + */ + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) + + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase + * minimums, this can be a subset of prices. + */ + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Minimum = + Minimum( + minimumAmount, + appliesToPriceIds.map { it.toImmutable() }, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Minimum && this.minimumAmount == other.minimumAmount && this.appliesToPriceIds == other.appliesToPriceIds && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + } + + class ModelType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ModelType && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val PACKAGE = ModelType(JsonField.of("package")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - UNIT, + PACKAGE, } enum class Value { - UNIT, + PACKAGE, _UNKNOWN, } fun value(): Value = when (this) { - UNIT -> Value.UNIT + PACKAGE -> Value.PACKAGE else -> Value._UNKNOWN } fun known(): Known = when (this) { - UNIT -> Known.UNIT + PACKAGE -> Known.PACKAGE else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PriceType && this.value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val USAGE_PRICE = PriceType(JsonField.of("usage_price")) - - @JvmField val FIXED_PRICE = PriceType(JsonField.of("fixed_price")) - - @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) - } - - enum class Known { - USAGE_PRICE, - FIXED_PRICE, - } - - enum class Value { - USAGE_PRICE, - FIXED_PRICE, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - USAGE_PRICE -> Value.USAGE_PRICE - FIXED_PRICE -> Value.FIXED_PRICE - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - USAGE_PRICE -> Known.USAGE_PRICE - FIXED_PRICE -> Known.FIXED_PRICE - else -> throw OrbInvalidDataException("Unknown PriceType: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - - @JsonDeserialize(builder = UnitConfig.Builder::class) + @JsonDeserialize(builder = PackageConfig.Builder::class) @NoAutoDetect - class UnitConfig + class PackageConfig private constructor( - private val unitAmount: JsonField, + private val packageAmount: JsonField, + private val packageSize: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false - /** Rate per unit of usage */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") + /** A currency amount to rate usage by */ + fun packageAmount(): String = packageAmount.getRequired("package_amount") - /** Rate per unit of usage */ - @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount + /** + * An integer amount to represent package size. For example, 1000 here would divide + * usage by 1000 before multiplying by package_amount in rating + */ + fun packageSize(): Long = packageSize.getRequired("package_size") + + /** A currency amount to rate usage by */ + @JsonProperty("package_amount") @ExcludeMissing fun _packageAmount() = packageAmount + + /** + * An integer amount to represent package size. For example, 1000 here would divide + * usage by 1000 before multiplying by package_amount in rating + */ + @JsonProperty("package_size") @ExcludeMissing fun _packageSize() = packageSize @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): UnitConfig = apply { + fun validate(): PackageConfig = apply { if (!validated) { - unitAmount() + packageAmount() + packageSize() validated = true } } @@ -2435,23 +4192,42 @@ private constructor( class Builder { - private var unitAmount: JsonField = JsonMissing.of() + private var packageAmount: JsonField = JsonMissing.of() + private var packageSize: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(unitConfig: UnitConfig) = apply { - this.unitAmount = unitConfig.unitAmount - additionalProperties(unitConfig.additionalProperties) + internal fun from(packageConfig: PackageConfig) = apply { + this.packageAmount = packageConfig.packageAmount + this.packageSize = packageConfig.packageSize + additionalProperties(packageConfig.additionalProperties) } - /** Rate per unit of usage */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) + /** A currency amount to rate usage by */ + fun packageAmount(packageAmount: String) = + packageAmount(JsonField.of(packageAmount)) - /** Rate per unit of usage */ - @JsonProperty("unit_amount") + /** A currency amount to rate usage by */ + @JsonProperty("package_amount") @ExcludeMissing - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount + fun packageAmount(packageAmount: JsonField) = apply { + this.packageAmount = packageAmount + } + + /** + * An integer amount to represent package size. For example, 1000 here would divide + * usage by 1000 before multiplying by package_amount in rating + */ + fun packageSize(packageSize: Long) = packageSize(JsonField.of(packageSize)) + + /** + * An integer amount to represent package size. For example, 1000 here would divide + * usage by 1000 before multiplying by package_amount in rating + */ + @JsonProperty("package_size") + @ExcludeMissing + fun packageSize(packageSize: JsonField) = apply { + this.packageSize = packageSize } fun additionalProperties(additionalProperties: Map) = apply { @@ -2469,7 +4245,12 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): UnitConfig = UnitConfig(unitAmount, additionalProperties.toImmutable()) + fun build(): PackageConfig = + PackageConfig( + packageAmount, + packageSize, + additionalProperties.toImmutable(), + ) } override fun equals(other: Any?): Boolean { @@ -2477,20 +4258,77 @@ private constructor( return true } - return /* spotless:off */ other is UnitConfig && this.unitAmount == other.unitAmount && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PackageConfig && this.packageAmount == other.packageAmount && this.packageSize == other.packageSize && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(unitAmount, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(packageAmount, packageSize, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "UnitConfig{unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "PackageConfig{packageAmount=$packageAmount, packageSize=$packageSize, additionalProperties=$additionalProperties}" + } + + class PriceType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is PriceType && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val USAGE_PRICE = PriceType(JsonField.of("usage_price")) + + @JvmField val FIXED_PRICE = PriceType(JsonField.of("fixed_price")) + + @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) + } + + enum class Known { + USAGE_PRICE, + FIXED_PRICE, + } + + enum class Value { + USAGE_PRICE, + FIXED_PRICE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + USAGE_PRICE -> Value.USAGE_PRICE + FIXED_PRICE -> Value.FIXED_PRICE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + USAGE_PRICE -> Known.USAGE_PRICE + FIXED_PRICE -> Known.FIXED_PRICE + else -> throw OrbInvalidDataException("Unknown PriceType: $value") + } + + fun asString(): String = _value().asStringOrThrow() } override fun equals(other: Any?): Boolean { @@ -2498,25 +4336,25 @@ private constructor( return true } - return /* spotless:off */ other is UnitPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.unitConfig == other.unitConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PackagePrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.packageConfig == other.packageConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, unitConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, packageConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "UnitPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, unitConfig=$unitConfig, additionalProperties=$additionalProperties}" + "PackagePrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, packageConfig=$packageConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = PackagePrice.Builder::class) + @JsonDeserialize(builder = MatrixPrice.Builder::class) @NoAutoDetect - class PackagePrice + class MatrixPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -2540,7 +4378,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val packageConfig: JsonField, + private val matrixConfig: JsonField, private val additionalProperties: Map, ) { @@ -2607,7 +4445,7 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun packageConfig(): PackageConfig = packageConfig.getRequired("package_config") + fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -2666,13 +4504,13 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("package_config") @ExcludeMissing fun _packageConfig() = packageConfig + @JsonProperty("matrix_config") @ExcludeMissing fun _matrixConfig() = matrixConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): PackagePrice = apply { + fun validate(): MatrixPrice = apply { if (!validated) { metadata().validate() id() @@ -2696,7 +4534,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - packageConfig().validate() + matrixConfig().validate() validated = true } } @@ -2734,35 +4572,35 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var packageConfig: JsonField = JsonMissing.of() + private var matrixConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(packagePrice: PackagePrice) = apply { - this.metadata = packagePrice.metadata - this.id = packagePrice.id - this.name = packagePrice.name - this.externalPriceId = packagePrice.externalPriceId - this.priceType = packagePrice.priceType - this.modelType = packagePrice.modelType - this.createdAt = packagePrice.createdAt - this.cadence = packagePrice.cadence - this.billingCycleConfiguration = packagePrice.billingCycleConfiguration - this.invoicingCycleConfiguration = packagePrice.invoicingCycleConfiguration - this.billableMetric = packagePrice.billableMetric - this.fixedPriceQuantity = packagePrice.fixedPriceQuantity - this.planPhaseOrder = packagePrice.planPhaseOrder - this.currency = packagePrice.currency - this.conversionRate = packagePrice.conversionRate - this.item = packagePrice.item - this.creditAllocation = packagePrice.creditAllocation - this.discount = packagePrice.discount - this.minimum = packagePrice.minimum - this.minimumAmount = packagePrice.minimumAmount - this.maximum = packagePrice.maximum - this.maximumAmount = packagePrice.maximumAmount - this.packageConfig = packagePrice.packageConfig - additionalProperties(packagePrice.additionalProperties) + internal fun from(matrixPrice: MatrixPrice) = apply { + this.metadata = matrixPrice.metadata + this.id = matrixPrice.id + this.name = matrixPrice.name + this.externalPriceId = matrixPrice.externalPriceId + this.priceType = matrixPrice.priceType + this.modelType = matrixPrice.modelType + this.createdAt = matrixPrice.createdAt + this.cadence = matrixPrice.cadence + this.billingCycleConfiguration = matrixPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = matrixPrice.invoicingCycleConfiguration + this.billableMetric = matrixPrice.billableMetric + this.fixedPriceQuantity = matrixPrice.fixedPriceQuantity + this.planPhaseOrder = matrixPrice.planPhaseOrder + this.currency = matrixPrice.currency + this.conversionRate = matrixPrice.conversionRate + this.item = matrixPrice.item + this.creditAllocation = matrixPrice.creditAllocation + this.discount = matrixPrice.discount + this.minimum = matrixPrice.minimum + this.minimumAmount = matrixPrice.minimumAmount + this.maximum = matrixPrice.maximum + this.maximumAmount = matrixPrice.maximumAmount + this.matrixConfig = matrixPrice.matrixConfig + additionalProperties(matrixPrice.additionalProperties) } /** @@ -2937,13 +4775,12 @@ private constructor( this.maximumAmount = maximumAmount } - fun packageConfig(packageConfig: PackageConfig) = - packageConfig(JsonField.of(packageConfig)) + fun matrixConfig(matrixConfig: MatrixConfig) = matrixConfig(JsonField.of(matrixConfig)) - @JsonProperty("package_config") + @JsonProperty("matrix_config") @ExcludeMissing - fun packageConfig(packageConfig: JsonField) = apply { - this.packageConfig = packageConfig + fun matrixConfig(matrixConfig: JsonField) = apply { + this.matrixConfig = matrixConfig } fun additionalProperties(additionalProperties: Map) = apply { @@ -2960,8 +4797,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): PackagePrice = - PackagePrice( + fun build(): MatrixPrice = + MatrixPrice( metadata, id, name, @@ -2984,7 +4821,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - packageConfig, + matrixConfig, additionalProperties.toImmutable(), ) } @@ -3710,46 +5547,47 @@ private constructor( "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Maximum.Builder::class) + @JsonDeserialize(builder = MatrixConfig.Builder::class) @NoAutoDetect - class Maximum + class MatrixConfig private constructor( - private val maximumAmount: JsonField, - private val appliesToPriceIds: JsonField>, + private val dimensions: JsonField>, + private val defaultUnitAmount: JsonField, + private val matrixValues: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false - /** Maximum amount applied */ - fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(): List = dimensions.getRequired("dimensions") - /** - * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, - * this can be a subset of prices. - */ - fun appliesToPriceIds(): List = - appliesToPriceIds.getRequired("applies_to_price_ids") + /** Default per unit rate for any usage not bucketed into a specified matrix_value */ + fun defaultUnitAmount(): String = defaultUnitAmount.getRequired("default_unit_amount") - /** Maximum amount applied */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** Matrix values for specified matrix grouping keys */ + fun matrixValues(): List = matrixValues.getRequired("matrix_values") - /** - * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, - * this can be a subset of prices. - */ - @JsonProperty("applies_to_price_ids") + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") @ExcludeMissing fun _dimensions() = dimensions + + /** Default per unit rate for any usage not bucketed into a specified matrix_value */ + @JsonProperty("default_unit_amount") @ExcludeMissing - fun _appliesToPriceIds() = appliesToPriceIds + fun _defaultUnitAmount() = defaultUnitAmount + + /** Matrix values for specified matrix grouping keys */ + @JsonProperty("matrix_values") @ExcludeMissing fun _matrixValues() = matrixValues @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): Maximum = apply { + fun validate(): MatrixConfig = apply { if (!validated) { - maximumAmount() - appliesToPriceIds() + dimensions() + defaultUnitAmount() + matrixValues().forEach { it.validate() } validated = true } } @@ -3763,43 +5601,53 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() - private var appliesToPriceIds: JsonField> = JsonMissing.of() + private var dimensions: JsonField> = JsonMissing.of() + private var defaultUnitAmount: JsonField = JsonMissing.of() + private var matrixValues: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(maximum: Maximum) = apply { - this.maximumAmount = maximum.maximumAmount - this.appliesToPriceIds = maximum.appliesToPriceIds - additionalProperties(maximum.additionalProperties) + internal fun from(matrixConfig: MatrixConfig) = apply { + this.dimensions = matrixConfig.dimensions + this.defaultUnitAmount = matrixConfig.defaultUnitAmount + this.matrixValues = matrixConfig.matrixValues + additionalProperties(matrixConfig.additionalProperties) } - /** Maximum amount applied */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) - /** Maximum amount applied */ - @JsonProperty("maximum_amount") + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") @ExcludeMissing - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun dimensions(dimensions: JsonField>) = apply { + this.dimensions = dimensions } /** - * List of price_ids that this maximum amount applies to. For plan/plan phase - * maximums, this can be a subset of prices. + * Default per unit rate for any usage not bucketed into a specified matrix_value */ - fun appliesToPriceIds(appliesToPriceIds: List) = - appliesToPriceIds(JsonField.of(appliesToPriceIds)) + fun defaultUnitAmount(defaultUnitAmount: String) = + defaultUnitAmount(JsonField.of(defaultUnitAmount)) /** - * List of price_ids that this maximum amount applies to. For plan/plan phase - * maximums, this can be a subset of prices. + * Default per unit rate for any usage not bucketed into a specified matrix_value */ - @JsonProperty("applies_to_price_ids") + @JsonProperty("default_unit_amount") @ExcludeMissing - fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { - this.appliesToPriceIds = appliesToPriceIds + fun defaultUnitAmount(defaultUnitAmount: JsonField) = apply { + this.defaultUnitAmount = defaultUnitAmount + } + + /** Matrix values for specified matrix grouping keys */ + fun matrixValues(matrixValues: List) = + matrixValues(JsonField.of(matrixValues)) + + /** Matrix values for specified matrix grouping keys */ + @JsonProperty("matrix_values") + @ExcludeMissing + fun matrixValues(matrixValues: JsonField>) = apply { + this.matrixValues = matrixValues } fun additionalProperties(additionalProperties: Map) = apply { @@ -3817,91 +5665,152 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Maximum = - Maximum( - maximumAmount, - appliesToPriceIds.map { it.toImmutable() }, + fun build(): MatrixConfig = + MatrixConfig( + dimensions.map { it.toImmutable() }, + defaultUnitAmount, + matrixValues.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JsonDeserialize(builder = MatrixValue.Builder::class) + @NoAutoDetect + class MatrixValue + private constructor( + private val unitAmount: JsonField, + private val dimensionValues: JsonField>, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** Unit price for the specified dimension_values */ + fun unitAmount(): String = unitAmount.getRequired("unit_amount") + + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and an + * instance tier. + */ + fun dimensionValues(): List = + dimensionValues.getRequired("dimension_values") + + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount + + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and an + * instance tier. + */ + @JsonProperty("dimension_values") + @ExcludeMissing + fun _dimensionValues() = dimensionValues + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): MatrixValue = apply { + if (!validated) { + unitAmount() + dimensionValues() + validated = true + } } - return /* spotless:off */ other is Maximum && this.maximumAmount == other.maximumAmount && this.appliesToPriceIds == other.appliesToPriceIds && this.additionalProperties == other.additionalProperties /* spotless:on */ - } + fun toBuilder() = Builder().from(this) - private var hashCode: Int = 0 + companion object { - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) /* spotless:on */ + @JvmStatic fun builder() = Builder() } - return hashCode - } - override fun toString() = - "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" - } + class Builder { - /** - * User specified key-value pairs for the resource. If not present, this defaults to an - * empty dictionary. Individual keys can be removed by setting the value to `null`, and the - * entire metadata mapping can be cleared by setting `metadata` to `null`. - */ - @JsonDeserialize(builder = Metadata.Builder::class) - @NoAutoDetect - class Metadata - private constructor( - private val additionalProperties: Map, - ) { + private var unitAmount: JsonField = JsonMissing.of() + private var dimensionValues: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - private var validated: Boolean = false + @JvmSynthetic + internal fun from(matrixValue: MatrixValue) = apply { + this.unitAmount = matrixValue.unitAmount + this.dimensionValues = matrixValue.dimensionValues + additionalProperties(matrixValue.additionalProperties) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - fun validate(): Metadata = apply { - if (!validated) { - validated = true - } - } + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") + @ExcludeMissing + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount + } - fun toBuilder() = Builder().from(this) + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and + * an instance tier. + */ + fun dimensionValues(dimensionValues: List) = + dimensionValues(JsonField.of(dimensionValues)) - companion object { + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and + * an instance tier. + */ + @JsonProperty("dimension_values") + @ExcludeMissing + fun dimensionValues(dimensionValues: JsonField>) = apply { + this.dimensionValues = dimensionValues + } - @JvmStatic fun builder() = Builder() - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } - class Builder { + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } - private var additionalProperties: MutableMap = mutableMapOf() + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties(metadata.additionalProperties) + fun build(): MatrixValue = + MatrixValue( + unitAmount, + dimensionValues.map { it.toImmutable() }, + additionalProperties.toImmutable(), + ) } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + return /* spotless:off */ other is MatrixValue && this.unitAmount == other.unitAmount && this.dimensionValues == other.dimensionValues && this.additionalProperties == other.additionalProperties /* spotless:on */ } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(unitAmount, dimensionValues, additionalProperties) /* spotless:on */ } + return hashCode + } - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + override fun toString() = + "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -3909,47 +5818,48 @@ private constructor( return true } - return /* spotless:off */ other is Metadata && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixConfig && this.dimensions == other.dimensions && this.defaultUnitAmount == other.defaultUnitAmount && this.matrixValues == other.matrixValues && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(dimensions, defaultUnitAmount, matrixValues, additionalProperties) /* spotless:on */ } return hashCode } - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + override fun toString() = + "MatrixConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Minimum.Builder::class) + @JsonDeserialize(builder = Maximum.Builder::class) @NoAutoDetect - class Minimum + class Maximum private constructor( - private val minimumAmount: JsonField, + private val maximumAmount: JsonField, private val appliesToPriceIds: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false - /** Minimum amount applied */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") + /** Maximum amount applied */ + fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount") /** - * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, + * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. */ fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids") - /** Minimum amount applied */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount /** - * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, + * List of price_ids that this maximum amount applies to. For plan/plan phase maximums, * this can be a subset of prices. */ @JsonProperty("applies_to_price_ids") @@ -3960,9 +5870,9 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): Minimum = apply { + fun validate(): Maximum = apply { if (!validated) { - minimumAmount() + maximumAmount() appliesToPriceIds() validated = true } @@ -3977,38 +5887,38 @@ private constructor( class Builder { - private var minimumAmount: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() private var appliesToPriceIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(minimum: Minimum) = apply { - this.minimumAmount = minimum.minimumAmount - this.appliesToPriceIds = minimum.appliesToPriceIds - additionalProperties(minimum.additionalProperties) + internal fun from(maximum: Maximum) = apply { + this.maximumAmount = maximum.maximumAmount + this.appliesToPriceIds = maximum.appliesToPriceIds + additionalProperties(maximum.additionalProperties) } - /** Minimum amount applied */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) + /** Maximum amount applied */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) - /** Minimum amount applied */ - @JsonProperty("minimum_amount") + /** Maximum amount applied */ + @JsonProperty("maximum_amount") @ExcludeMissing - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount } /** - * List of price_ids that this minimum amount applies to. For plan/plan phase - * minimums, this can be a subset of prices. + * List of price_ids that this maximum amount applies to. For plan/plan phase + * maximums, this can be a subset of prices. */ fun appliesToPriceIds(appliesToPriceIds: List) = appliesToPriceIds(JsonField.of(appliesToPriceIds)) /** - * List of price_ids that this minimum amount applies to. For plan/plan phase - * minimums, this can be a subset of prices. + * List of price_ids that this maximum amount applies to. For plan/plan phase + * maximums, this can be a subset of prices. */ @JsonProperty("applies_to_price_ids") @ExcludeMissing @@ -4031,9 +5941,9 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Minimum = - Minimum( - minimumAmount, + fun build(): Maximum = + Maximum( + maximumAmount, appliesToPriceIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) @@ -4044,110 +5954,140 @@ private constructor( return true } - return /* spotless:off */ other is Minimum && this.minimumAmount == other.minimumAmount && this.appliesToPriceIds == other.appliesToPriceIds && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Maximum && this.maximumAmount == other.maximumAmount && this.appliesToPriceIds == other.appliesToPriceIds && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(maximumAmount, appliesToPriceIds, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + "Maximum{maximumAmount=$maximumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" } - class ModelType - @JsonCreator + /** + * User specified key-value pairs for the resource. If not present, this defaults to an + * empty dictionary. Individual keys can be removed by setting the value to `null`, and the + * entire metadata mapping can be cleared by setting `metadata` to `null`. + */ + @JsonDeserialize(builder = Metadata.Builder::class) + @NoAutoDetect + class Metadata private constructor( - private val value: JsonField, - ) : Enum { + private val additionalProperties: Map, + ) { - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Metadata = apply { + if (!validated) { + validated = true } + } - return /* spotless:off */ other is ModelType && this.value == other.value /* spotless:on */ + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() } - override fun hashCode() = value.hashCode() + class Builder { - override fun toString() = value.toString() + private var additionalProperties: MutableMap = mutableMapOf() - companion object { + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties(metadata.additionalProperties) + } - @JvmField val PACKAGE = ModelType(JsonField.of("package")) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } - @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) - } + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } - enum class Known { - PACKAGE, - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - enum class Value { - PACKAGE, - _UNKNOWN, + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) } - fun value(): Value = - when (this) { - PACKAGE -> Value.PACKAGE - else -> Value._UNKNOWN + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - fun known(): Known = - when (this) { - PACKAGE -> Known.PACKAGE - else -> throw OrbInvalidDataException("Unknown ModelType: $value") + return /* spotless:off */ other is Metadata && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ } + return hashCode + } - fun asString(): String = _value().asStringOrThrow() + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = PackageConfig.Builder::class) + @JsonDeserialize(builder = Minimum.Builder::class) @NoAutoDetect - class PackageConfig + class Minimum private constructor( - private val packageAmount: JsonField, - private val packageSize: JsonField, + private val minimumAmount: JsonField, + private val appliesToPriceIds: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false - /** A currency amount to rate usage by */ - fun packageAmount(): String = packageAmount.getRequired("package_amount") + /** Minimum amount applied */ + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") /** - * An integer amount to represent package size. For example, 1000 here would divide - * usage by 1000 before multiplying by package_amount in rating + * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, + * this can be a subset of prices. */ - fun packageSize(): Long = packageSize.getRequired("package_size") + fun appliesToPriceIds(): List = + appliesToPriceIds.getRequired("applies_to_price_ids") - /** A currency amount to rate usage by */ - @JsonProperty("package_amount") @ExcludeMissing fun _packageAmount() = packageAmount + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount /** - * An integer amount to represent package size. For example, 1000 here would divide - * usage by 1000 before multiplying by package_amount in rating + * List of price_ids that this minimum amount applies to. For plan/plan phase minimums, + * this can be a subset of prices. */ - @JsonProperty("package_size") @ExcludeMissing fun _packageSize() = packageSize + @JsonProperty("applies_to_price_ids") + @ExcludeMissing + fun _appliesToPriceIds() = appliesToPriceIds @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): PackageConfig = apply { + fun validate(): Minimum = apply { if (!validated) { - packageAmount() - packageSize() + minimumAmount() + appliesToPriceIds() validated = true } } @@ -4161,42 +6101,43 @@ private constructor( class Builder { - private var packageAmount: JsonField = JsonMissing.of() - private var packageSize: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var appliesToPriceIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(packageConfig: PackageConfig) = apply { - this.packageAmount = packageConfig.packageAmount - this.packageSize = packageConfig.packageSize - additionalProperties(packageConfig.additionalProperties) + internal fun from(minimum: Minimum) = apply { + this.minimumAmount = minimum.minimumAmount + this.appliesToPriceIds = minimum.appliesToPriceIds + additionalProperties(minimum.additionalProperties) } - /** A currency amount to rate usage by */ - fun packageAmount(packageAmount: String) = - packageAmount(JsonField.of(packageAmount)) + /** Minimum amount applied */ + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) - /** A currency amount to rate usage by */ - @JsonProperty("package_amount") + /** Minimum amount applied */ + @JsonProperty("minimum_amount") @ExcludeMissing - fun packageAmount(packageAmount: JsonField) = apply { - this.packageAmount = packageAmount + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount } /** - * An integer amount to represent package size. For example, 1000 here would divide - * usage by 1000 before multiplying by package_amount in rating + * List of price_ids that this minimum amount applies to. For plan/plan phase + * minimums, this can be a subset of prices. */ - fun packageSize(packageSize: Long) = packageSize(JsonField.of(packageSize)) + fun appliesToPriceIds(appliesToPriceIds: List) = + appliesToPriceIds(JsonField.of(appliesToPriceIds)) /** - * An integer amount to represent package size. For example, 1000 here would divide - * usage by 1000 before multiplying by package_amount in rating + * List of price_ids that this minimum amount applies to. For plan/plan phase + * minimums, this can be a subset of prices. */ - @JsonProperty("package_size") + @JsonProperty("applies_to_price_ids") @ExcludeMissing - fun packageSize(packageSize: JsonField) = apply { - this.packageSize = packageSize + fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply { + this.appliesToPriceIds = appliesToPriceIds } fun additionalProperties(additionalProperties: Map) = apply { @@ -4214,10 +6155,10 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): PackageConfig = - PackageConfig( - packageAmount, - packageSize, + fun build(): Minimum = + Minimum( + minimumAmount, + appliesToPriceIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -4227,20 +6168,71 @@ private constructor( return true } - return /* spotless:off */ other is PackageConfig && this.packageAmount == other.packageAmount && this.packageSize == other.packageSize && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Minimum && this.minimumAmount == other.minimumAmount && this.appliesToPriceIds == other.appliesToPriceIds && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(packageAmount, packageSize, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(minimumAmount, appliesToPriceIds, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "PackageConfig{packageAmount=$packageAmount, packageSize=$packageSize, additionalProperties=$additionalProperties}" + "Minimum{minimumAmount=$minimumAmount, appliesToPriceIds=$appliesToPriceIds, additionalProperties=$additionalProperties}" + } + + class ModelType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ModelType && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val MATRIX = ModelType(JsonField.of("matrix")) + + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } + + enum class Known { + MATRIX, + } + + enum class Value { + MATRIX, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + MATRIX -> Value.MATRIX + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + MATRIX -> Known.MATRIX + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } + + fun asString(): String = _value().asStringOrThrow() } class PriceType @@ -4305,25 +6297,25 @@ private constructor( return true } - return /* spotless:off */ other is PackagePrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.packageConfig == other.packageConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.matrixConfig == other.matrixConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, packageConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, matrixConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "PackagePrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, packageConfig=$packageConfig, additionalProperties=$additionalProperties}" + "MatrixPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, matrixConfig=$matrixConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = MatrixPrice.Builder::class) + @JsonDeserialize(builder = TieredPrice.Builder::class) @NoAutoDetect - class MatrixPrice + class TieredPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -4347,7 +6339,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val matrixConfig: JsonField, + private val tieredConfig: JsonField, private val additionalProperties: Map, ) { @@ -4414,7 +6406,7 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun matrixConfig(): MatrixConfig = matrixConfig.getRequired("matrix_config") + fun tieredConfig(): TieredConfig = tieredConfig.getRequired("tiered_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -4473,13 +6465,13 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("matrix_config") @ExcludeMissing fun _matrixConfig() = matrixConfig + @JsonProperty("tiered_config") @ExcludeMissing fun _tieredConfig() = tieredConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): MatrixPrice = apply { + fun validate(): TieredPrice = apply { if (!validated) { metadata().validate() id() @@ -4503,7 +6495,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - matrixConfig().validate() + tieredConfig().validate() validated = true } } @@ -4541,35 +6533,35 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var matrixConfig: JsonField = JsonMissing.of() + private var tieredConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(matrixPrice: MatrixPrice) = apply { - this.metadata = matrixPrice.metadata - this.id = matrixPrice.id - this.name = matrixPrice.name - this.externalPriceId = matrixPrice.externalPriceId - this.priceType = matrixPrice.priceType - this.modelType = matrixPrice.modelType - this.createdAt = matrixPrice.createdAt - this.cadence = matrixPrice.cadence - this.billingCycleConfiguration = matrixPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = matrixPrice.invoicingCycleConfiguration - this.billableMetric = matrixPrice.billableMetric - this.fixedPriceQuantity = matrixPrice.fixedPriceQuantity - this.planPhaseOrder = matrixPrice.planPhaseOrder - this.currency = matrixPrice.currency - this.conversionRate = matrixPrice.conversionRate - this.item = matrixPrice.item - this.creditAllocation = matrixPrice.creditAllocation - this.discount = matrixPrice.discount - this.minimum = matrixPrice.minimum - this.minimumAmount = matrixPrice.minimumAmount - this.maximum = matrixPrice.maximum - this.maximumAmount = matrixPrice.maximumAmount - this.matrixConfig = matrixPrice.matrixConfig - additionalProperties(matrixPrice.additionalProperties) + internal fun from(tieredPrice: TieredPrice) = apply { + this.metadata = tieredPrice.metadata + this.id = tieredPrice.id + this.name = tieredPrice.name + this.externalPriceId = tieredPrice.externalPriceId + this.priceType = tieredPrice.priceType + this.modelType = tieredPrice.modelType + this.createdAt = tieredPrice.createdAt + this.cadence = tieredPrice.cadence + this.billingCycleConfiguration = tieredPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = tieredPrice.invoicingCycleConfiguration + this.billableMetric = tieredPrice.billableMetric + this.fixedPriceQuantity = tieredPrice.fixedPriceQuantity + this.planPhaseOrder = tieredPrice.planPhaseOrder + this.currency = tieredPrice.currency + this.conversionRate = tieredPrice.conversionRate + this.item = tieredPrice.item + this.creditAllocation = tieredPrice.creditAllocation + this.discount = tieredPrice.discount + this.minimum = tieredPrice.minimum + this.minimumAmount = tieredPrice.minimumAmount + this.maximum = tieredPrice.maximum + this.maximumAmount = tieredPrice.maximumAmount + this.tieredConfig = tieredPrice.tieredConfig + additionalProperties(tieredPrice.additionalProperties) } /** @@ -4744,12 +6736,12 @@ private constructor( this.maximumAmount = maximumAmount } - fun matrixConfig(matrixConfig: MatrixConfig) = matrixConfig(JsonField.of(matrixConfig)) + fun tieredConfig(tieredConfig: TieredConfig) = tieredConfig(JsonField.of(tieredConfig)) - @JsonProperty("matrix_config") + @JsonProperty("tiered_config") @ExcludeMissing - fun matrixConfig(matrixConfig: JsonField) = apply { - this.matrixConfig = matrixConfig + fun tieredConfig(tieredConfig: JsonField) = apply { + this.tieredConfig = tieredConfig } fun additionalProperties(additionalProperties: Map) = apply { @@ -4766,8 +6758,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): MatrixPrice = - MatrixPrice( + fun build(): TieredPrice = + TieredPrice( metadata, id, name, @@ -4790,7 +6782,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - matrixConfig, + tieredConfig, additionalProperties.toImmutable(), ) } @@ -5516,293 +7508,6 @@ private constructor( "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = MatrixConfig.Builder::class) - @NoAutoDetect - class MatrixConfig - private constructor( - private val dimensions: JsonField>, - private val defaultUnitAmount: JsonField, - private val matrixValues: JsonField>, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(): List = dimensions.getRequired("dimensions") - - /** Default per unit rate for any usage not bucketed into a specified matrix_value */ - fun defaultUnitAmount(): String = defaultUnitAmount.getRequired("default_unit_amount") - - /** Matrix values for specified matrix grouping keys */ - fun matrixValues(): List = matrixValues.getRequired("matrix_values") - - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") @ExcludeMissing fun _dimensions() = dimensions - - /** Default per unit rate for any usage not bucketed into a specified matrix_value */ - @JsonProperty("default_unit_amount") - @ExcludeMissing - fun _defaultUnitAmount() = defaultUnitAmount - - /** Matrix values for specified matrix grouping keys */ - @JsonProperty("matrix_values") @ExcludeMissing fun _matrixValues() = matrixValues - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): MatrixConfig = apply { - if (!validated) { - dimensions() - defaultUnitAmount() - matrixValues().forEach { it.validate() } - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var dimensions: JsonField> = JsonMissing.of() - private var defaultUnitAmount: JsonField = JsonMissing.of() - private var matrixValues: JsonField> = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(matrixConfig: MatrixConfig) = apply { - this.dimensions = matrixConfig.dimensions - this.defaultUnitAmount = matrixConfig.defaultUnitAmount - this.matrixValues = matrixConfig.matrixValues - additionalProperties(matrixConfig.additionalProperties) - } - - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) - - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") - @ExcludeMissing - fun dimensions(dimensions: JsonField>) = apply { - this.dimensions = dimensions - } - - /** - * Default per unit rate for any usage not bucketed into a specified matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = - defaultUnitAmount(JsonField.of(defaultUnitAmount)) - - /** - * Default per unit rate for any usage not bucketed into a specified matrix_value - */ - @JsonProperty("default_unit_amount") - @ExcludeMissing - fun defaultUnitAmount(defaultUnitAmount: JsonField) = apply { - this.defaultUnitAmount = defaultUnitAmount - } - - /** Matrix values for specified matrix grouping keys */ - fun matrixValues(matrixValues: List) = - matrixValues(JsonField.of(matrixValues)) - - /** Matrix values for specified matrix grouping keys */ - @JsonProperty("matrix_values") - @ExcludeMissing - fun matrixValues(matrixValues: JsonField>) = apply { - this.matrixValues = matrixValues - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): MatrixConfig = - MatrixConfig( - dimensions.map { it.toImmutable() }, - defaultUnitAmount, - matrixValues.map { it.toImmutable() }, - additionalProperties.toImmutable(), - ) - } - - @JsonDeserialize(builder = MatrixValue.Builder::class) - @NoAutoDetect - class MatrixValue - private constructor( - private val unitAmount: JsonField, - private val dimensionValues: JsonField>, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - /** Unit price for the specified dimension_values */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and an - * instance tier. - */ - fun dimensionValues(): List = - dimensionValues.getRequired("dimension_values") - - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and an - * instance tier. - */ - @JsonProperty("dimension_values") - @ExcludeMissing - fun _dimensionValues() = dimensionValues - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): MatrixValue = apply { - if (!validated) { - unitAmount() - dimensionValues() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var unitAmount: JsonField = JsonMissing.of() - private var dimensionValues: JsonField> = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(matrixValue: MatrixValue) = apply { - this.unitAmount = matrixValue.unitAmount - this.dimensionValues = matrixValue.dimensionValues - additionalProperties(matrixValue.additionalProperties) - } - - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") - @ExcludeMissing - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount - } - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and - * an instance tier. - */ - fun dimensionValues(dimensionValues: List) = - dimensionValues(JsonField.of(dimensionValues)) - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and - * an instance tier. - */ - @JsonProperty("dimension_values") - @ExcludeMissing - fun dimensionValues(dimensionValues: JsonField>) = apply { - this.dimensionValues = dimensionValues - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): MatrixValue = - MatrixValue( - unitAmount, - dimensionValues.map { it.toImmutable() }, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is MatrixValue && this.unitAmount == other.unitAmount && this.dimensionValues == other.dimensionValues && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(unitAmount, dimensionValues, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is MatrixConfig && this.dimensions == other.dimensions && this.defaultUnitAmount == other.defaultUnitAmount && this.matrixValues == other.matrixValues && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(dimensions, defaultUnitAmount, matrixValues, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "MatrixConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, additionalProperties=$additionalProperties}" - } - @JsonDeserialize(builder = Maximum.Builder::class) @NoAutoDetect class Maximum @@ -6175,29 +7880,29 @@ private constructor( companion object { - @JvmField val MATRIX = ModelType(JsonField.of("matrix")) + @JvmField val TIERED = ModelType(JsonField.of("tiered")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - MATRIX, + TIERED, } enum class Value { - MATRIX, + TIERED, _UNKNOWN, } fun value(): Value = when (this) { - MATRIX -> Value.MATRIX + TIERED -> Value.TIERED else -> Value._UNKNOWN } fun known(): Known = when (this) { - MATRIX -> Known.MATRIX + TIERED -> Known.TIERED else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -6261,30 +7966,262 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } + @JsonDeserialize(builder = TieredConfig.Builder::class) + @NoAutoDetect + class TieredConfig + private constructor( + private val tiers: JsonField>, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** Tiers for rating based on total usage quantities into the specified tier */ + fun tiers(): List = tiers.getRequired("tiers") + + /** Tiers for rating based on total usage quantities into the specified tier */ + @JsonProperty("tiers") @ExcludeMissing fun _tiers() = tiers + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): TieredConfig = apply { + if (!validated) { + tiers().forEach { it.validate() } + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var tiers: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tieredConfig: TieredConfig) = apply { + this.tiers = tieredConfig.tiers + additionalProperties(tieredConfig.additionalProperties) + } + + /** Tiers for rating based on total usage quantities into the specified tier */ + fun tiers(tiers: List) = tiers(JsonField.of(tiers)) + + /** Tiers for rating based on total usage quantities into the specified tier */ + @JsonProperty("tiers") + @ExcludeMissing + fun tiers(tiers: JsonField>) = apply { this.tiers = tiers } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): TieredConfig = + TieredConfig(tiers.map { it.toImmutable() }, additionalProperties.toImmutable()) + } + + @JsonDeserialize(builder = Tier.Builder::class) + @NoAutoDetect + class Tier + private constructor( + private val firstUnit: JsonField, + private val lastUnit: JsonField, + private val unitAmount: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** Inclusive tier starting value */ + fun firstUnit(): Double = firstUnit.getRequired("first_unit") + + /** Exclusive tier ending value. If null, this is treated as the last tier */ + fun lastUnit(): Optional = + Optional.ofNullable(lastUnit.getNullable("last_unit")) + + /** Amount per unit */ + fun unitAmount(): String = unitAmount.getRequired("unit_amount") + + /** Inclusive tier starting value */ + @JsonProperty("first_unit") @ExcludeMissing fun _firstUnit() = firstUnit + + /** Exclusive tier ending value. If null, this is treated as the last tier */ + @JsonProperty("last_unit") @ExcludeMissing fun _lastUnit() = lastUnit + + /** Amount per unit */ + @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Tier = apply { + if (!validated) { + firstUnit() + lastUnit() + unitAmount() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var firstUnit: JsonField = JsonMissing.of() + private var lastUnit: JsonField = JsonMissing.of() + private var unitAmount: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tier: Tier) = apply { + this.firstUnit = tier.firstUnit + this.lastUnit = tier.lastUnit + this.unitAmount = tier.unitAmount + additionalProperties(tier.additionalProperties) + } + + /** Inclusive tier starting value */ + fun firstUnit(firstUnit: Double) = firstUnit(JsonField.of(firstUnit)) + + /** Inclusive tier starting value */ + @JsonProperty("first_unit") + @ExcludeMissing + fun firstUnit(firstUnit: JsonField) = apply { + this.firstUnit = firstUnit + } + + /** Exclusive tier ending value. If null, this is treated as the last tier */ + fun lastUnit(lastUnit: Double) = lastUnit(JsonField.of(lastUnit)) + + /** Exclusive tier ending value. If null, this is treated as the last tier */ + @JsonProperty("last_unit") + @ExcludeMissing + fun lastUnit(lastUnit: JsonField) = apply { this.lastUnit = lastUnit } + + /** Amount per unit */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) + + /** Amount per unit */ + @JsonProperty("unit_amount") + @ExcludeMissing + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Tier = + Tier( + firstUnit, + lastUnit, + unitAmount, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Tier && this.firstUnit == other.firstUnit && this.lastUnit == other.lastUnit && this.unitAmount == other.unitAmount && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(firstUnit, lastUnit, unitAmount, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "Tier{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TieredConfig && this.tiers == other.tiers && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(tiers, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "TieredConfig{tiers=$tiers, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is MatrixPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.matrixConfig == other.matrixConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.tieredConfig == other.tieredConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, matrixConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "MatrixPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, matrixConfig=$matrixConfig, additionalProperties=$additionalProperties}" + "TieredPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredConfig=$tieredConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = TieredPrice.Builder::class) + @JsonDeserialize(builder = TieredBpsPrice.Builder::class) @NoAutoDetect - class TieredPrice + class TieredBpsPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -6308,7 +8245,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val tieredConfig: JsonField, + private val tieredBpsConfig: JsonField, private val additionalProperties: Map, ) { @@ -6375,7 +8312,7 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun tieredConfig(): TieredConfig = tieredConfig.getRequired("tiered_config") + fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig.getRequired("tiered_bps_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -6434,13 +8371,13 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("tiered_config") @ExcludeMissing fun _tieredConfig() = tieredConfig + @JsonProperty("tiered_bps_config") @ExcludeMissing fun _tieredBpsConfig() = tieredBpsConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): TieredPrice = apply { + fun validate(): TieredBpsPrice = apply { if (!validated) { metadata().validate() id() @@ -6464,7 +8401,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - tieredConfig().validate() + tieredBpsConfig().validate() validated = true } } @@ -6502,35 +8439,35 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var tieredConfig: JsonField = JsonMissing.of() + private var tieredBpsConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredPrice: TieredPrice) = apply { - this.metadata = tieredPrice.metadata - this.id = tieredPrice.id - this.name = tieredPrice.name - this.externalPriceId = tieredPrice.externalPriceId - this.priceType = tieredPrice.priceType - this.modelType = tieredPrice.modelType - this.createdAt = tieredPrice.createdAt - this.cadence = tieredPrice.cadence - this.billingCycleConfiguration = tieredPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = tieredPrice.invoicingCycleConfiguration - this.billableMetric = tieredPrice.billableMetric - this.fixedPriceQuantity = tieredPrice.fixedPriceQuantity - this.planPhaseOrder = tieredPrice.planPhaseOrder - this.currency = tieredPrice.currency - this.conversionRate = tieredPrice.conversionRate - this.item = tieredPrice.item - this.creditAllocation = tieredPrice.creditAllocation - this.discount = tieredPrice.discount - this.minimum = tieredPrice.minimum - this.minimumAmount = tieredPrice.minimumAmount - this.maximum = tieredPrice.maximum - this.maximumAmount = tieredPrice.maximumAmount - this.tieredConfig = tieredPrice.tieredConfig - additionalProperties(tieredPrice.additionalProperties) + internal fun from(tieredBpsPrice: TieredBpsPrice) = apply { + this.metadata = tieredBpsPrice.metadata + this.id = tieredBpsPrice.id + this.name = tieredBpsPrice.name + this.externalPriceId = tieredBpsPrice.externalPriceId + this.priceType = tieredBpsPrice.priceType + this.modelType = tieredBpsPrice.modelType + this.createdAt = tieredBpsPrice.createdAt + this.cadence = tieredBpsPrice.cadence + this.billingCycleConfiguration = tieredBpsPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = tieredBpsPrice.invoicingCycleConfiguration + this.billableMetric = tieredBpsPrice.billableMetric + this.fixedPriceQuantity = tieredBpsPrice.fixedPriceQuantity + this.planPhaseOrder = tieredBpsPrice.planPhaseOrder + this.currency = tieredBpsPrice.currency + this.conversionRate = tieredBpsPrice.conversionRate + this.item = tieredBpsPrice.item + this.creditAllocation = tieredBpsPrice.creditAllocation + this.discount = tieredBpsPrice.discount + this.minimum = tieredBpsPrice.minimum + this.minimumAmount = tieredBpsPrice.minimumAmount + this.maximum = tieredBpsPrice.maximum + this.maximumAmount = tieredBpsPrice.maximumAmount + this.tieredBpsConfig = tieredBpsPrice.tieredBpsConfig + additionalProperties(tieredBpsPrice.additionalProperties) } /** @@ -6705,12 +8642,13 @@ private constructor( this.maximumAmount = maximumAmount } - fun tieredConfig(tieredConfig: TieredConfig) = tieredConfig(JsonField.of(tieredConfig)) + fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = + tieredBpsConfig(JsonField.of(tieredBpsConfig)) - @JsonProperty("tiered_config") + @JsonProperty("tiered_bps_config") @ExcludeMissing - fun tieredConfig(tieredConfig: JsonField) = apply { - this.tieredConfig = tieredConfig + fun tieredBpsConfig(tieredBpsConfig: JsonField) = apply { + this.tieredBpsConfig = tieredBpsConfig } fun additionalProperties(additionalProperties: Map) = apply { @@ -6727,8 +8665,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): TieredPrice = - TieredPrice( + fun build(): TieredBpsPrice = + TieredBpsPrice( metadata, id, name, @@ -6751,7 +8689,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - tieredConfig, + tieredBpsConfig, additionalProperties.toImmutable(), ) } @@ -7849,29 +9787,29 @@ private constructor( companion object { - @JvmField val TIERED = ModelType(JsonField.of("tiered")) + @JvmField val TIERED_BPS = ModelType(JsonField.of("tiered_bps")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - TIERED, + TIERED_BPS, } enum class Value { - TIERED, + TIERED_BPS, _UNKNOWN, } fun value(): Value = when (this) { - TIERED -> Value.TIERED + TIERED_BPS -> Value.TIERED_BPS else -> Value._UNKNOWN } fun known(): Known = when (this) { - TIERED -> Known.TIERED + TIERED_BPS -> Known.TIERED_BPS else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -7935,9 +9873,9 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } - @JsonDeserialize(builder = TieredConfig.Builder::class) + @JsonDeserialize(builder = TieredBpsConfig.Builder::class) @NoAutoDetect - class TieredConfig + class TieredBpsConfig private constructor( private val tiers: JsonField>, private val additionalProperties: Map, @@ -7945,17 +9883,21 @@ private constructor( private var validated: Boolean = false - /** Tiers for rating based on total usage quantities into the specified tier */ + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified tiers + */ fun tiers(): List = tiers.getRequired("tiers") - /** Tiers for rating based on total usage quantities into the specified tier */ + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified tiers + */ @JsonProperty("tiers") @ExcludeMissing fun _tiers() = tiers @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): TieredConfig = apply { + fun validate(): TieredBpsConfig = apply { if (!validated) { tiers().forEach { it.validate() } validated = true @@ -7975,15 +9917,21 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredConfig: TieredConfig) = apply { - this.tiers = tieredConfig.tiers - additionalProperties(tieredConfig.additionalProperties) + internal fun from(tieredBpsConfig: TieredBpsConfig) = apply { + this.tiers = tieredBpsConfig.tiers + additionalProperties(tieredBpsConfig.additionalProperties) } - /** Tiers for rating based on total usage quantities into the specified tier */ + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified + * tiers + */ fun tiers(tiers: List) = tiers(JsonField.of(tiers)) - /** Tiers for rating based on total usage quantities into the specified tier */ + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified + * tiers + */ @JsonProperty("tiers") @ExcludeMissing fun tiers(tiers: JsonField>) = apply { this.tiers = tiers } @@ -8003,40 +9951,53 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): TieredConfig = - TieredConfig(tiers.map { it.toImmutable() }, additionalProperties.toImmutable()) + fun build(): TieredBpsConfig = + TieredBpsConfig( + tiers.map { it.toImmutable() }, + additionalProperties.toImmutable() + ) } @JsonDeserialize(builder = Tier.Builder::class) @NoAutoDetect class Tier private constructor( - private val firstUnit: JsonField, - private val lastUnit: JsonField, - private val unitAmount: JsonField, + private val minimumAmount: JsonField, + private val maximumAmount: JsonField, + private val bps: JsonField, + private val perUnitMaximum: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false /** Inclusive tier starting value */ - fun firstUnit(): Double = firstUnit.getRequired("first_unit") + fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - /** Exclusive tier ending value. If null, this is treated as the last tier */ - fun lastUnit(): Optional = - Optional.ofNullable(lastUnit.getNullable("last_unit")) + /** Exclusive tier ending value */ + fun maximumAmount(): Optional = + Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - /** Amount per unit */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") + /** Per-event basis point rate */ + fun bps(): Double = bps.getRequired("bps") + + /** Per unit maximum to charge */ + fun perUnitMaximum(): Optional = + Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) /** Inclusive tier starting value */ - @JsonProperty("first_unit") @ExcludeMissing fun _firstUnit() = firstUnit + @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - /** Exclusive tier ending value. If null, this is treated as the last tier */ - @JsonProperty("last_unit") @ExcludeMissing fun _lastUnit() = lastUnit + /** Exclusive tier ending value */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - /** Amount per unit */ - @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount + /** Per-event basis point rate */ + @JsonProperty("bps") @ExcludeMissing fun _bps() = bps + + /** Per unit maximum to charge */ + @JsonProperty("per_unit_maximum") + @ExcludeMissing + fun _perUnitMaximum() = perUnitMaximum @JsonAnyGetter @ExcludeMissing @@ -8044,9 +10005,10 @@ private constructor( fun validate(): Tier = apply { if (!validated) { - firstUnit() - lastUnit() - unitAmount() + minimumAmount() + maximumAmount() + bps() + perUnitMaximum() validated = true } } @@ -8060,45 +10022,60 @@ private constructor( class Builder { - private var firstUnit: JsonField = JsonMissing.of() - private var lastUnit: JsonField = JsonMissing.of() - private var unitAmount: JsonField = JsonMissing.of() + private var minimumAmount: JsonField = JsonMissing.of() + private var maximumAmount: JsonField = JsonMissing.of() + private var bps: JsonField = JsonMissing.of() + private var perUnitMaximum: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - this.firstUnit = tier.firstUnit - this.lastUnit = tier.lastUnit - this.unitAmount = tier.unitAmount + this.minimumAmount = tier.minimumAmount + this.maximumAmount = tier.maximumAmount + this.bps = tier.bps + this.perUnitMaximum = tier.perUnitMaximum additionalProperties(tier.additionalProperties) } /** Inclusive tier starting value */ - fun firstUnit(firstUnit: Double) = firstUnit(JsonField.of(firstUnit)) + fun minimumAmount(minimumAmount: String) = + minimumAmount(JsonField.of(minimumAmount)) /** Inclusive tier starting value */ - @JsonProperty("first_unit") + @JsonProperty("minimum_amount") @ExcludeMissing - fun firstUnit(firstUnit: JsonField) = apply { - this.firstUnit = firstUnit + fun minimumAmount(minimumAmount: JsonField) = apply { + this.minimumAmount = minimumAmount } - /** Exclusive tier ending value. If null, this is treated as the last tier */ - fun lastUnit(lastUnit: Double) = lastUnit(JsonField.of(lastUnit)) + /** Exclusive tier ending value */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) - /** Exclusive tier ending value. If null, this is treated as the last tier */ - @JsonProperty("last_unit") + /** Exclusive tier ending value */ + @JsonProperty("maximum_amount") @ExcludeMissing - fun lastUnit(lastUnit: JsonField) = apply { this.lastUnit = lastUnit } + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } - /** Amount per unit */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) + /** Per-event basis point rate */ + fun bps(bps: Double) = bps(JsonField.of(bps)) - /** Amount per unit */ - @JsonProperty("unit_amount") + /** Per-event basis point rate */ + @JsonProperty("bps") @ExcludeMissing - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount + fun bps(bps: JsonField) = apply { this.bps = bps } + + /** Per unit maximum to charge */ + fun perUnitMaximum(perUnitMaximum: String) = + perUnitMaximum(JsonField.of(perUnitMaximum)) + + /** Per unit maximum to charge */ + @JsonProperty("per_unit_maximum") + @ExcludeMissing + fun perUnitMaximum(perUnitMaximum: JsonField) = apply { + this.perUnitMaximum = perUnitMaximum } fun additionalProperties(additionalProperties: Map) = apply { @@ -8118,9 +10095,10 @@ private constructor( fun build(): Tier = Tier( - firstUnit, - lastUnit, - unitAmount, + minimumAmount, + maximumAmount, + bps, + perUnitMaximum, additionalProperties.toImmutable(), ) } @@ -8130,20 +10108,20 @@ private constructor( return true } - return /* spotless:off */ other is Tier && this.firstUnit == other.firstUnit && this.lastUnit == other.lastUnit && this.unitAmount == other.unitAmount && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && this.minimumAmount == other.minimumAmount && this.maximumAmount == other.maximumAmount && this.bps == other.bps && this.perUnitMaximum == other.perUnitMaximum && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(firstUnit, lastUnit, unitAmount, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(minimumAmount, maximumAmount, bps, perUnitMaximum, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "Tier{firstUnit=$firstUnit, lastUnit=$lastUnit, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" + "Tier{minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -8151,7 +10129,7 @@ private constructor( return true } - return /* spotless:off */ other is TieredConfig && this.tiers == other.tiers && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredBpsConfig && this.tiers == other.tiers && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 @@ -8164,7 +10142,7 @@ private constructor( } override fun toString() = - "TieredConfig{tiers=$tiers, additionalProperties=$additionalProperties}" + "TieredBpsConfig{tiers=$tiers, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -8172,25 +10150,25 @@ private constructor( return true } - return /* spotless:off */ other is TieredPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.tieredConfig == other.tieredConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredBpsPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.tieredBpsConfig == other.tieredBpsConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredBpsConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "TieredPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredConfig=$tieredConfig, additionalProperties=$additionalProperties}" + "TieredBpsPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredBpsConfig=$tieredBpsConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = TieredBpsPrice.Builder::class) + @JsonDeserialize(builder = BpsPrice.Builder::class) @NoAutoDetect - class TieredBpsPrice + class BpsPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -8214,7 +10192,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val tieredBpsConfig: JsonField, + private val bpsConfig: JsonField, private val additionalProperties: Map, ) { @@ -8281,7 +10259,7 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun tieredBpsConfig(): TieredBpsConfig = tieredBpsConfig.getRequired("tiered_bps_config") + fun bpsConfig(): BpsConfig = bpsConfig.getRequired("bps_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -8340,13 +10318,13 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("tiered_bps_config") @ExcludeMissing fun _tieredBpsConfig() = tieredBpsConfig + @JsonProperty("bps_config") @ExcludeMissing fun _bpsConfig() = bpsConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): TieredBpsPrice = apply { + fun validate(): BpsPrice = apply { if (!validated) { metadata().validate() id() @@ -8370,7 +10348,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - tieredBpsConfig().validate() + bpsConfig().validate() validated = true } } @@ -8408,35 +10386,35 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var tieredBpsConfig: JsonField = JsonMissing.of() + private var bpsConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredBpsPrice: TieredBpsPrice) = apply { - this.metadata = tieredBpsPrice.metadata - this.id = tieredBpsPrice.id - this.name = tieredBpsPrice.name - this.externalPriceId = tieredBpsPrice.externalPriceId - this.priceType = tieredBpsPrice.priceType - this.modelType = tieredBpsPrice.modelType - this.createdAt = tieredBpsPrice.createdAt - this.cadence = tieredBpsPrice.cadence - this.billingCycleConfiguration = tieredBpsPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = tieredBpsPrice.invoicingCycleConfiguration - this.billableMetric = tieredBpsPrice.billableMetric - this.fixedPriceQuantity = tieredBpsPrice.fixedPriceQuantity - this.planPhaseOrder = tieredBpsPrice.planPhaseOrder - this.currency = tieredBpsPrice.currency - this.conversionRate = tieredBpsPrice.conversionRate - this.item = tieredBpsPrice.item - this.creditAllocation = tieredBpsPrice.creditAllocation - this.discount = tieredBpsPrice.discount - this.minimum = tieredBpsPrice.minimum - this.minimumAmount = tieredBpsPrice.minimumAmount - this.maximum = tieredBpsPrice.maximum - this.maximumAmount = tieredBpsPrice.maximumAmount - this.tieredBpsConfig = tieredBpsPrice.tieredBpsConfig - additionalProperties(tieredBpsPrice.additionalProperties) + internal fun from(bpsPrice: BpsPrice) = apply { + this.metadata = bpsPrice.metadata + this.id = bpsPrice.id + this.name = bpsPrice.name + this.externalPriceId = bpsPrice.externalPriceId + this.priceType = bpsPrice.priceType + this.modelType = bpsPrice.modelType + this.createdAt = bpsPrice.createdAt + this.cadence = bpsPrice.cadence + this.billingCycleConfiguration = bpsPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = bpsPrice.invoicingCycleConfiguration + this.billableMetric = bpsPrice.billableMetric + this.fixedPriceQuantity = bpsPrice.fixedPriceQuantity + this.planPhaseOrder = bpsPrice.planPhaseOrder + this.currency = bpsPrice.currency + this.conversionRate = bpsPrice.conversionRate + this.item = bpsPrice.item + this.creditAllocation = bpsPrice.creditAllocation + this.discount = bpsPrice.discount + this.minimum = bpsPrice.minimum + this.minimumAmount = bpsPrice.minimumAmount + this.maximum = bpsPrice.maximum + this.maximumAmount = bpsPrice.maximumAmount + this.bpsConfig = bpsPrice.bpsConfig + additionalProperties(bpsPrice.additionalProperties) } /** @@ -8611,14 +10589,11 @@ private constructor( this.maximumAmount = maximumAmount } - fun tieredBpsConfig(tieredBpsConfig: TieredBpsConfig) = - tieredBpsConfig(JsonField.of(tieredBpsConfig)) + fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) - @JsonProperty("tiered_bps_config") + @JsonProperty("bps_config") @ExcludeMissing - fun tieredBpsConfig(tieredBpsConfig: JsonField) = apply { - this.tieredBpsConfig = tieredBpsConfig - } + fun bpsConfig(bpsConfig: JsonField) = apply { this.bpsConfig = bpsConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -8634,8 +10609,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): TieredBpsPrice = - TieredBpsPrice( + fun build(): BpsPrice = + BpsPrice( metadata, id, name, @@ -8658,7 +10633,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - tieredBpsConfig, + bpsConfig, additionalProperties.toImmutable(), ) } @@ -8918,6 +10893,125 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } + @JsonDeserialize(builder = BpsConfig.Builder::class) + @NoAutoDetect + class BpsConfig + private constructor( + private val bps: JsonField, + private val perUnitMaximum: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** Basis point take rate per event */ + fun bps(): Double = bps.getRequired("bps") + + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(): Optional = + Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) + + /** Basis point take rate per event */ + @JsonProperty("bps") @ExcludeMissing fun _bps() = bps + + /** Optional currency amount maximum to cap spend per event */ + @JsonProperty("per_unit_maximum") @ExcludeMissing fun _perUnitMaximum() = perUnitMaximum + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): BpsConfig = apply { + if (!validated) { + bps() + perUnitMaximum() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var bps: JsonField = JsonMissing.of() + private var perUnitMaximum: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(bpsConfig: BpsConfig) = apply { + this.bps = bpsConfig.bps + this.perUnitMaximum = bpsConfig.perUnitMaximum + additionalProperties(bpsConfig.additionalProperties) + } + + /** Basis point take rate per event */ + fun bps(bps: Double) = bps(JsonField.of(bps)) + + /** Basis point take rate per event */ + @JsonProperty("bps") + @ExcludeMissing + fun bps(bps: JsonField) = apply { this.bps = bps } + + /** Optional currency amount maximum to cap spend per event */ + fun perUnitMaximum(perUnitMaximum: String) = + perUnitMaximum(JsonField.of(perUnitMaximum)) + + /** Optional currency amount maximum to cap spend per event */ + @JsonProperty("per_unit_maximum") + @ExcludeMissing + fun perUnitMaximum(perUnitMaximum: JsonField) = apply { + this.perUnitMaximum = perUnitMaximum + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): BpsConfig = + BpsConfig( + bps, + perUnitMaximum, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BpsConfig && this.bps == other.bps && this.perUnitMaximum == other.perUnitMaximum && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(bps, perUnitMaximum, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "BpsConfig{bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + } + class Cadence @JsonCreator private constructor( @@ -9756,29 +11850,29 @@ private constructor( companion object { - @JvmField val TIERED_BPS = ModelType(JsonField.of("tiered_bps")) + @JvmField val BPS = ModelType(JsonField.of("bps")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - TIERED_BPS, + BPS, } enum class Value { - TIERED_BPS, + BPS, _UNKNOWN, } fun value(): Value = when (this) { - TIERED_BPS -> Value.TIERED_BPS + BPS -> Value.BPS else -> Value._UNKNOWN } fun known(): Known = when (this) { - TIERED_BPS -> Known.TIERED_BPS + BPS -> Known.BPS else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -9842,302 +11936,30 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } - @JsonDeserialize(builder = TieredBpsConfig.Builder::class) - @NoAutoDetect - class TieredBpsConfig - private constructor( - private val tiers: JsonField>, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - /** - * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified tiers - */ - fun tiers(): List = tiers.getRequired("tiers") - - /** - * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified tiers - */ - @JsonProperty("tiers") @ExcludeMissing fun _tiers() = tiers - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): TieredBpsConfig = apply { - if (!validated) { - tiers().forEach { it.validate() } - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var tiers: JsonField> = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(tieredBpsConfig: TieredBpsConfig) = apply { - this.tiers = tieredBpsConfig.tiers - additionalProperties(tieredBpsConfig.additionalProperties) - } - - /** - * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified - * tiers - */ - fun tiers(tiers: List) = tiers(JsonField.of(tiers)) - - /** - * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified - * tiers - */ - @JsonProperty("tiers") - @ExcludeMissing - fun tiers(tiers: JsonField>) = apply { this.tiers = tiers } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): TieredBpsConfig = - TieredBpsConfig( - tiers.map { it.toImmutable() }, - additionalProperties.toImmutable() - ) - } - - @JsonDeserialize(builder = Tier.Builder::class) - @NoAutoDetect - class Tier - private constructor( - private val minimumAmount: JsonField, - private val maximumAmount: JsonField, - private val bps: JsonField, - private val perUnitMaximum: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - /** Inclusive tier starting value */ - fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount") - - /** Exclusive tier ending value */ - fun maximumAmount(): Optional = - Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - - /** Per-event basis point rate */ - fun bps(): Double = bps.getRequired("bps") - - /** Per unit maximum to charge */ - fun perUnitMaximum(): Optional = - Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) - - /** Inclusive tier starting value */ - @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount - - /** Exclusive tier ending value */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - - /** Per-event basis point rate */ - @JsonProperty("bps") @ExcludeMissing fun _bps() = bps - - /** Per unit maximum to charge */ - @JsonProperty("per_unit_maximum") - @ExcludeMissing - fun _perUnitMaximum() = perUnitMaximum - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Tier = apply { - if (!validated) { - minimumAmount() - maximumAmount() - bps() - perUnitMaximum() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var minimumAmount: JsonField = JsonMissing.of() - private var maximumAmount: JsonField = JsonMissing.of() - private var bps: JsonField = JsonMissing.of() - private var perUnitMaximum: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(tier: Tier) = apply { - this.minimumAmount = tier.minimumAmount - this.maximumAmount = tier.maximumAmount - this.bps = tier.bps - this.perUnitMaximum = tier.perUnitMaximum - additionalProperties(tier.additionalProperties) - } - - /** Inclusive tier starting value */ - fun minimumAmount(minimumAmount: String) = - minimumAmount(JsonField.of(minimumAmount)) - - /** Inclusive tier starting value */ - @JsonProperty("minimum_amount") - @ExcludeMissing - fun minimumAmount(minimumAmount: JsonField) = apply { - this.minimumAmount = minimumAmount - } - - /** Exclusive tier ending value */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) - - /** Exclusive tier ending value */ - @JsonProperty("maximum_amount") - @ExcludeMissing - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount - } - - /** Per-event basis point rate */ - fun bps(bps: Double) = bps(JsonField.of(bps)) - - /** Per-event basis point rate */ - @JsonProperty("bps") - @ExcludeMissing - fun bps(bps: JsonField) = apply { this.bps = bps } - - /** Per unit maximum to charge */ - fun perUnitMaximum(perUnitMaximum: String) = - perUnitMaximum(JsonField.of(perUnitMaximum)) - - /** Per unit maximum to charge */ - @JsonProperty("per_unit_maximum") - @ExcludeMissing - fun perUnitMaximum(perUnitMaximum: JsonField) = apply { - this.perUnitMaximum = perUnitMaximum - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): Tier = - Tier( - minimumAmount, - maximumAmount, - bps, - perUnitMaximum, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Tier && this.minimumAmount == other.minimumAmount && this.maximumAmount == other.maximumAmount && this.bps == other.bps && this.perUnitMaximum == other.perUnitMaximum && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(minimumAmount, maximumAmount, bps, perUnitMaximum, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "Tier{minimumAmount=$minimumAmount, maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TieredBpsConfig && this.tiers == other.tiers && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(tiers, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "TieredBpsConfig{tiers=$tiers, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is TieredBpsPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.tieredBpsConfig == other.tieredBpsConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BpsPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.bpsConfig == other.bpsConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredBpsConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, bpsConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "TieredBpsPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredBpsConfig=$tieredBpsConfig, additionalProperties=$additionalProperties}" + "BpsPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, bpsConfig=$bpsConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = BpsPrice.Builder::class) + @JsonDeserialize(builder = BulkBpsPrice.Builder::class) @NoAutoDetect - class BpsPrice + class BulkBpsPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -10161,7 +11983,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val bpsConfig: JsonField, + private val bulkBpsConfig: JsonField, private val additionalProperties: Map, ) { @@ -10228,7 +12050,7 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun bpsConfig(): BpsConfig = bpsConfig.getRequired("bps_config") + fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig.getRequired("bulk_bps_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -10287,13 +12109,13 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("bps_config") @ExcludeMissing fun _bpsConfig() = bpsConfig + @JsonProperty("bulk_bps_config") @ExcludeMissing fun _bulkBpsConfig() = bulkBpsConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): BpsPrice = apply { + fun validate(): BulkBpsPrice = apply { if (!validated) { metadata().validate() id() @@ -10317,7 +12139,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - bpsConfig().validate() + bulkBpsConfig().validate() validated = true } } @@ -10355,35 +12177,35 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var bpsConfig: JsonField = JsonMissing.of() + private var bulkBpsConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bpsPrice: BpsPrice) = apply { - this.metadata = bpsPrice.metadata - this.id = bpsPrice.id - this.name = bpsPrice.name - this.externalPriceId = bpsPrice.externalPriceId - this.priceType = bpsPrice.priceType - this.modelType = bpsPrice.modelType - this.createdAt = bpsPrice.createdAt - this.cadence = bpsPrice.cadence - this.billingCycleConfiguration = bpsPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = bpsPrice.invoicingCycleConfiguration - this.billableMetric = bpsPrice.billableMetric - this.fixedPriceQuantity = bpsPrice.fixedPriceQuantity - this.planPhaseOrder = bpsPrice.planPhaseOrder - this.currency = bpsPrice.currency - this.conversionRate = bpsPrice.conversionRate - this.item = bpsPrice.item - this.creditAllocation = bpsPrice.creditAllocation - this.discount = bpsPrice.discount - this.minimum = bpsPrice.minimum - this.minimumAmount = bpsPrice.minimumAmount - this.maximum = bpsPrice.maximum - this.maximumAmount = bpsPrice.maximumAmount - this.bpsConfig = bpsPrice.bpsConfig - additionalProperties(bpsPrice.additionalProperties) + internal fun from(bulkBpsPrice: BulkBpsPrice) = apply { + this.metadata = bulkBpsPrice.metadata + this.id = bulkBpsPrice.id + this.name = bulkBpsPrice.name + this.externalPriceId = bulkBpsPrice.externalPriceId + this.priceType = bulkBpsPrice.priceType + this.modelType = bulkBpsPrice.modelType + this.createdAt = bulkBpsPrice.createdAt + this.cadence = bulkBpsPrice.cadence + this.billingCycleConfiguration = bulkBpsPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = bulkBpsPrice.invoicingCycleConfiguration + this.billableMetric = bulkBpsPrice.billableMetric + this.fixedPriceQuantity = bulkBpsPrice.fixedPriceQuantity + this.planPhaseOrder = bulkBpsPrice.planPhaseOrder + this.currency = bulkBpsPrice.currency + this.conversionRate = bulkBpsPrice.conversionRate + this.item = bulkBpsPrice.item + this.creditAllocation = bulkBpsPrice.creditAllocation + this.discount = bulkBpsPrice.discount + this.minimum = bulkBpsPrice.minimum + this.minimumAmount = bulkBpsPrice.minimumAmount + this.maximum = bulkBpsPrice.maximum + this.maximumAmount = bulkBpsPrice.maximumAmount + this.bulkBpsConfig = bulkBpsPrice.bulkBpsConfig + additionalProperties(bulkBpsPrice.additionalProperties) } /** @@ -10558,11 +12380,14 @@ private constructor( this.maximumAmount = maximumAmount } - fun bpsConfig(bpsConfig: BpsConfig) = bpsConfig(JsonField.of(bpsConfig)) + fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = + bulkBpsConfig(JsonField.of(bulkBpsConfig)) - @JsonProperty("bps_config") + @JsonProperty("bulk_bps_config") @ExcludeMissing - fun bpsConfig(bpsConfig: JsonField) = apply { this.bpsConfig = bpsConfig } + fun bulkBpsConfig(bulkBpsConfig: JsonField) = apply { + this.bulkBpsConfig = bulkBpsConfig + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -10578,8 +12403,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): BpsPrice = - BpsPrice( + fun build(): BulkBpsPrice = + BulkBpsPrice( metadata, id, name, @@ -10602,7 +12427,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - bpsConfig, + bulkBpsConfig, additionalProperties.toImmutable(), ) } @@ -10862,38 +12687,35 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = BpsConfig.Builder::class) + @JsonDeserialize(builder = BulkBpsConfig.Builder::class) @NoAutoDetect - class BpsConfig + class BulkBpsConfig private constructor( - private val bps: JsonField, - private val perUnitMaximum: JsonField, + private val tiers: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false - /** Basis point take rate per event */ - fun bps(): Double = bps.getRequired("bps") - - /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(): Optional = - Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) - - /** Basis point take rate per event */ - @JsonProperty("bps") @ExcludeMissing fun _bps() = bps + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier + * based on total volume + */ + fun tiers(): List = tiers.getRequired("tiers") - /** Optional currency amount maximum to cap spend per event */ - @JsonProperty("per_unit_maximum") @ExcludeMissing fun _perUnitMaximum() = perUnitMaximum + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier + * based on total volume + */ + @JsonProperty("tiers") @ExcludeMissing fun _tiers() = tiers @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): BpsConfig = apply { + fun validate(): BulkBpsConfig = apply { if (!validated) { - bps() - perUnitMaximum() + tiers().forEach { it.validate() } validated = true } } @@ -10907,35 +12729,28 @@ private constructor( class Builder { - private var bps: JsonField = JsonMissing.of() - private var perUnitMaximum: JsonField = JsonMissing.of() + private var tiers: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bpsConfig: BpsConfig) = apply { - this.bps = bpsConfig.bps - this.perUnitMaximum = bpsConfig.perUnitMaximum - additionalProperties(bpsConfig.additionalProperties) + internal fun from(bulkBpsConfig: BulkBpsConfig) = apply { + this.tiers = bulkBpsConfig.tiers + additionalProperties(bulkBpsConfig.additionalProperties) } - /** Basis point take rate per event */ - fun bps(bps: Double) = bps(JsonField.of(bps)) - - /** Basis point take rate per event */ - @JsonProperty("bps") - @ExcludeMissing - fun bps(bps: JsonField) = apply { this.bps = bps } - - /** Optional currency amount maximum to cap spend per event */ - fun perUnitMaximum(perUnitMaximum: String) = - perUnitMaximum(JsonField.of(perUnitMaximum)) + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier + * based on total volume + */ + fun tiers(tiers: List) = tiers(JsonField.of(tiers)) - /** Optional currency amount maximum to cap spend per event */ - @JsonProperty("per_unit_maximum") + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier + * based on total volume + */ + @JsonProperty("tiers") @ExcludeMissing - fun perUnitMaximum(perUnitMaximum: JsonField) = apply { - this.perUnitMaximum = perUnitMaximum - } + fun tiers(tiers: JsonField>) = apply { this.tiers = tiers } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -10952,33 +12767,176 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): BpsConfig = - BpsConfig( - bps, - perUnitMaximum, - additionalProperties.toImmutable(), + fun build(): BulkBpsConfig = + BulkBpsConfig( + tiers.map { it.toImmutable() }, + additionalProperties.toImmutable() ) } + @JsonDeserialize(builder = Tier.Builder::class) + @NoAutoDetect + class Tier + private constructor( + private val maximumAmount: JsonField, + private val bps: JsonField, + private val perUnitMaximum: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** Upper bound for tier */ + fun maximumAmount(): Optional = + Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) + + /** Basis points to rate on */ + fun bps(): Double = bps.getRequired("bps") + + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(): Optional = + Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) + + /** Upper bound for tier */ + @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + + /** Basis points to rate on */ + @JsonProperty("bps") @ExcludeMissing fun _bps() = bps + + /** The maximum amount to charge for any one event */ + @JsonProperty("per_unit_maximum") + @ExcludeMissing + fun _perUnitMaximum() = perUnitMaximum + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Tier = apply { + if (!validated) { + maximumAmount() + bps() + perUnitMaximum() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var maximumAmount: JsonField = JsonMissing.of() + private var bps: JsonField = JsonMissing.of() + private var perUnitMaximum: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tier: Tier) = apply { + this.maximumAmount = tier.maximumAmount + this.bps = tier.bps + this.perUnitMaximum = tier.perUnitMaximum + additionalProperties(tier.additionalProperties) + } + + /** Upper bound for tier */ + fun maximumAmount(maximumAmount: String) = + maximumAmount(JsonField.of(maximumAmount)) + + /** Upper bound for tier */ + @JsonProperty("maximum_amount") + @ExcludeMissing + fun maximumAmount(maximumAmount: JsonField) = apply { + this.maximumAmount = maximumAmount + } + + /** Basis points to rate on */ + fun bps(bps: Double) = bps(JsonField.of(bps)) + + /** Basis points to rate on */ + @JsonProperty("bps") + @ExcludeMissing + fun bps(bps: JsonField) = apply { this.bps = bps } + + /** The maximum amount to charge for any one event */ + fun perUnitMaximum(perUnitMaximum: String) = + perUnitMaximum(JsonField.of(perUnitMaximum)) + + /** The maximum amount to charge for any one event */ + @JsonProperty("per_unit_maximum") + @ExcludeMissing + fun perUnitMaximum(perUnitMaximum: JsonField) = apply { + this.perUnitMaximum = perUnitMaximum + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Tier = + Tier( + maximumAmount, + bps, + perUnitMaximum, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Tier && this.maximumAmount == other.maximumAmount && this.bps == other.bps && this.perUnitMaximum == other.perUnitMaximum && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(maximumAmount, bps, perUnitMaximum, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "Tier{maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is BpsConfig && this.bps == other.bps && this.perUnitMaximum == other.perUnitMaximum && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkBpsConfig && this.tiers == other.tiers && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(bps, perUnitMaximum, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(tiers, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "BpsConfig{bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "BulkBpsConfig{tiers=$tiers, additionalProperties=$additionalProperties}" } class Cadence @@ -11819,29 +13777,29 @@ private constructor( companion object { - @JvmField val BPS = ModelType(JsonField.of("bps")) + @JvmField val BULK_BPS = ModelType(JsonField.of("bulk_bps")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - BPS, + BULK_BPS, } enum class Value { - BPS, + BULK_BPS, _UNKNOWN, } fun value(): Value = when (this) { - BPS -> Value.BPS + BULK_BPS -> Value.BULK_BPS else -> Value._UNKNOWN } fun known(): Known = when (this) { - BPS -> Known.BPS + BULK_BPS -> Known.BULK_BPS else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -11910,25 +13868,25 @@ private constructor( return true } - return /* spotless:off */ other is BpsPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.bpsConfig == other.bpsConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkBpsPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.bulkBpsConfig == other.bulkBpsConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, bpsConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, bulkBpsConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "BpsPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, bpsConfig=$bpsConfig, additionalProperties=$additionalProperties}" + "BulkBpsPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, bulkBpsConfig=$bulkBpsConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = BulkBpsPrice.Builder::class) + @JsonDeserialize(builder = BulkPrice.Builder::class) @NoAutoDetect - class BulkBpsPrice + class BulkPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -11952,7 +13910,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val bulkBpsConfig: JsonField, + private val bulkConfig: JsonField, private val additionalProperties: Map, ) { @@ -12019,7 +13977,7 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun bulkBpsConfig(): BulkBpsConfig = bulkBpsConfig.getRequired("bulk_bps_config") + fun bulkConfig(): BulkConfig = bulkConfig.getRequired("bulk_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -12078,13 +14036,13 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("bulk_bps_config") @ExcludeMissing fun _bulkBpsConfig() = bulkBpsConfig + @JsonProperty("bulk_config") @ExcludeMissing fun _bulkConfig() = bulkConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): BulkBpsPrice = apply { + fun validate(): BulkPrice = apply { if (!validated) { metadata().validate() id() @@ -12108,7 +14066,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - bulkBpsConfig().validate() + bulkConfig().validate() validated = true } } @@ -12146,35 +14104,35 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var bulkBpsConfig: JsonField = JsonMissing.of() + private var bulkConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bulkBpsPrice: BulkBpsPrice) = apply { - this.metadata = bulkBpsPrice.metadata - this.id = bulkBpsPrice.id - this.name = bulkBpsPrice.name - this.externalPriceId = bulkBpsPrice.externalPriceId - this.priceType = bulkBpsPrice.priceType - this.modelType = bulkBpsPrice.modelType - this.createdAt = bulkBpsPrice.createdAt - this.cadence = bulkBpsPrice.cadence - this.billingCycleConfiguration = bulkBpsPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = bulkBpsPrice.invoicingCycleConfiguration - this.billableMetric = bulkBpsPrice.billableMetric - this.fixedPriceQuantity = bulkBpsPrice.fixedPriceQuantity - this.planPhaseOrder = bulkBpsPrice.planPhaseOrder - this.currency = bulkBpsPrice.currency - this.conversionRate = bulkBpsPrice.conversionRate - this.item = bulkBpsPrice.item - this.creditAllocation = bulkBpsPrice.creditAllocation - this.discount = bulkBpsPrice.discount - this.minimum = bulkBpsPrice.minimum - this.minimumAmount = bulkBpsPrice.minimumAmount - this.maximum = bulkBpsPrice.maximum - this.maximumAmount = bulkBpsPrice.maximumAmount - this.bulkBpsConfig = bulkBpsPrice.bulkBpsConfig - additionalProperties(bulkBpsPrice.additionalProperties) + internal fun from(bulkPrice: BulkPrice) = apply { + this.metadata = bulkPrice.metadata + this.id = bulkPrice.id + this.name = bulkPrice.name + this.externalPriceId = bulkPrice.externalPriceId + this.priceType = bulkPrice.priceType + this.modelType = bulkPrice.modelType + this.createdAt = bulkPrice.createdAt + this.cadence = bulkPrice.cadence + this.billingCycleConfiguration = bulkPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = bulkPrice.invoicingCycleConfiguration + this.billableMetric = bulkPrice.billableMetric + this.fixedPriceQuantity = bulkPrice.fixedPriceQuantity + this.planPhaseOrder = bulkPrice.planPhaseOrder + this.currency = bulkPrice.currency + this.conversionRate = bulkPrice.conversionRate + this.item = bulkPrice.item + this.creditAllocation = bulkPrice.creditAllocation + this.discount = bulkPrice.discount + this.minimum = bulkPrice.minimum + this.minimumAmount = bulkPrice.minimumAmount + this.maximum = bulkPrice.maximum + this.maximumAmount = bulkPrice.maximumAmount + this.bulkConfig = bulkPrice.bulkConfig + additionalProperties(bulkPrice.additionalProperties) } /** @@ -12349,13 +14307,12 @@ private constructor( this.maximumAmount = maximumAmount } - fun bulkBpsConfig(bulkBpsConfig: BulkBpsConfig) = - bulkBpsConfig(JsonField.of(bulkBpsConfig)) + fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) - @JsonProperty("bulk_bps_config") + @JsonProperty("bulk_config") @ExcludeMissing - fun bulkBpsConfig(bulkBpsConfig: JsonField) = apply { - this.bulkBpsConfig = bulkBpsConfig + fun bulkConfig(bulkConfig: JsonField) = apply { + this.bulkConfig = bulkConfig } fun additionalProperties(additionalProperties: Map) = apply { @@ -12372,8 +14329,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): BulkBpsPrice = - BulkBpsPrice( + fun build(): BulkPrice = + BulkPrice( metadata, id, name, @@ -12396,7 +14353,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - bulkBpsConfig, + bulkConfig, additionalProperties.toImmutable(), ) } @@ -12656,9 +14613,9 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = BulkBpsConfig.Builder::class) + @JsonDeserialize(builder = BulkConfig.Builder::class) @NoAutoDetect - class BulkBpsConfig + class BulkConfig private constructor( private val tiers: JsonField>, private val additionalProperties: Map, @@ -12666,23 +14623,17 @@ private constructor( private var validated: Boolean = false - /** - * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier - * based on total volume - */ + /** Bulk tiers for rating based on total usage volume */ fun tiers(): List = tiers.getRequired("tiers") - /** - * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier - * based on total volume - */ + /** Bulk tiers for rating based on total usage volume */ @JsonProperty("tiers") @ExcludeMissing fun _tiers() = tiers @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): BulkBpsConfig = apply { + fun validate(): BulkConfig = apply { if (!validated) { tiers().forEach { it.validate() } validated = true @@ -12702,21 +14653,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bulkBpsConfig: BulkBpsConfig) = apply { - this.tiers = bulkBpsConfig.tiers - additionalProperties(bulkBpsConfig.additionalProperties) + internal fun from(bulkConfig: BulkConfig) = apply { + this.tiers = bulkConfig.tiers + additionalProperties(bulkConfig.additionalProperties) } - /** - * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier - * based on total volume - */ + /** Bulk tiers for rating based on total usage volume */ fun tiers(tiers: List) = tiers(JsonField.of(tiers)) - /** - * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier - * based on total volume - */ + /** Bulk tiers for rating based on total usage volume */ @JsonProperty("tiers") @ExcludeMissing fun tiers(tiers: JsonField>) = apply { this.tiers = tiers } @@ -12736,46 +14681,33 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): BulkBpsConfig = - BulkBpsConfig( - tiers.map { it.toImmutable() }, - additionalProperties.toImmutable() - ) + fun build(): BulkConfig = + BulkConfig(tiers.map { it.toImmutable() }, additionalProperties.toImmutable()) } @JsonDeserialize(builder = Tier.Builder::class) @NoAutoDetect class Tier private constructor( - private val maximumAmount: JsonField, - private val bps: JsonField, - private val perUnitMaximum: JsonField, + private val maximumUnits: JsonField, + private val unitAmount: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false - /** Upper bound for tier */ - fun maximumAmount(): Optional = - Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - - /** Basis points to rate on */ - fun bps(): Double = bps.getRequired("bps") - - /** The maximum amount to charge for any one event */ - fun perUnitMaximum(): Optional = - Optional.ofNullable(perUnitMaximum.getNullable("per_unit_maximum")) + /** Upper bound for this tier */ + fun maximumUnits(): Optional = + Optional.ofNullable(maximumUnits.getNullable("maximum_units")) - /** Upper bound for tier */ - @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount + /** Amount per unit */ + fun unitAmount(): String = unitAmount.getRequired("unit_amount") - /** Basis points to rate on */ - @JsonProperty("bps") @ExcludeMissing fun _bps() = bps + /** Upper bound for this tier */ + @JsonProperty("maximum_units") @ExcludeMissing fun _maximumUnits() = maximumUnits - /** The maximum amount to charge for any one event */ - @JsonProperty("per_unit_maximum") - @ExcludeMissing - fun _perUnitMaximum() = perUnitMaximum + /** Amount per unit */ + @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount @JsonAnyGetter @ExcludeMissing @@ -12783,9 +14715,8 @@ private constructor( fun validate(): Tier = apply { if (!validated) { - maximumAmount() - bps() - perUnitMaximum() + maximumUnits() + unitAmount() validated = true } } @@ -12799,47 +14730,36 @@ private constructor( class Builder { - private var maximumAmount: JsonField = JsonMissing.of() - private var bps: JsonField = JsonMissing.of() - private var perUnitMaximum: JsonField = JsonMissing.of() + private var maximumUnits: JsonField = JsonMissing.of() + private var unitAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(tier: Tier) = apply { - this.maximumAmount = tier.maximumAmount - this.bps = tier.bps - this.perUnitMaximum = tier.perUnitMaximum + this.maximumUnits = tier.maximumUnits + this.unitAmount = tier.unitAmount additionalProperties(tier.additionalProperties) } - /** Upper bound for tier */ - fun maximumAmount(maximumAmount: String) = - maximumAmount(JsonField.of(maximumAmount)) + /** Upper bound for this tier */ + fun maximumUnits(maximumUnits: Double) = + maximumUnits(JsonField.of(maximumUnits)) - /** Upper bound for tier */ - @JsonProperty("maximum_amount") + /** Upper bound for this tier */ + @JsonProperty("maximum_units") @ExcludeMissing - fun maximumAmount(maximumAmount: JsonField) = apply { - this.maximumAmount = maximumAmount + fun maximumUnits(maximumUnits: JsonField) = apply { + this.maximumUnits = maximumUnits } - /** Basis points to rate on */ - fun bps(bps: Double) = bps(JsonField.of(bps)) - - /** Basis points to rate on */ - @JsonProperty("bps") - @ExcludeMissing - fun bps(bps: JsonField) = apply { this.bps = bps } - - /** The maximum amount to charge for any one event */ - fun perUnitMaximum(perUnitMaximum: String) = - perUnitMaximum(JsonField.of(perUnitMaximum)) + /** Amount per unit */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - /** The maximum amount to charge for any one event */ - @JsonProperty("per_unit_maximum") + /** Amount per unit */ + @JsonProperty("unit_amount") @ExcludeMissing - fun perUnitMaximum(perUnitMaximum: JsonField) = apply { - this.perUnitMaximum = perUnitMaximum + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount } fun additionalProperties(additionalProperties: Map) = apply { @@ -12859,9 +14779,8 @@ private constructor( fun build(): Tier = Tier( - maximumAmount, - bps, - perUnitMaximum, + maximumUnits, + unitAmount, additionalProperties.toImmutable(), ) } @@ -12871,20 +14790,20 @@ private constructor( return true } - return /* spotless:off */ other is Tier && this.maximumAmount == other.maximumAmount && this.bps == other.bps && this.perUnitMaximum == other.perUnitMaximum && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tier && this.maximumUnits == other.maximumUnits && this.unitAmount == other.unitAmount && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(maximumAmount, bps, perUnitMaximum, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(maximumUnits, unitAmount, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "Tier{maximumAmount=$maximumAmount, bps=$bps, perUnitMaximum=$perUnitMaximum, additionalProperties=$additionalProperties}" + "Tier{maximumUnits=$maximumUnits, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -12892,7 +14811,7 @@ private constructor( return true } - return /* spotless:off */ other is BulkBpsConfig && this.tiers == other.tiers && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkConfig && this.tiers == other.tiers && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 @@ -12905,7 +14824,7 @@ private constructor( } override fun toString() = - "BulkBpsConfig{tiers=$tiers, additionalProperties=$additionalProperties}" + "BulkConfig{tiers=$tiers, additionalProperties=$additionalProperties}" } class Cadence @@ -13746,29 +15665,29 @@ private constructor( companion object { - @JvmField val BULK_BPS = ModelType(JsonField.of("bulk_bps")) + @JvmField val BULK = ModelType(JsonField.of("bulk")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - BULK_BPS, + BULK, } enum class Value { - BULK_BPS, + BULK, _UNKNOWN, } fun value(): Value = when (this) { - BULK_BPS -> Value.BULK_BPS + BULK -> Value.BULK else -> Value._UNKNOWN } fun known(): Known = when (this) { - BULK_BPS -> Known.BULK_BPS + BULK -> Known.BULK else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -13837,25 +15756,25 @@ private constructor( return true } - return /* spotless:off */ other is BulkBpsPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.bulkBpsConfig == other.bulkBpsConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.bulkConfig == other.bulkConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, bulkBpsConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, bulkConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "BulkBpsPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, bulkBpsConfig=$bulkBpsConfig, additionalProperties=$additionalProperties}" + "BulkPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, bulkConfig=$bulkConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = BulkPrice.Builder::class) + @JsonDeserialize(builder = ThresholdTotalAmountPrice.Builder::class) @NoAutoDetect - class BulkPrice + class ThresholdTotalAmountPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -13879,7 +15798,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val bulkConfig: JsonField, + private val thresholdTotalAmountConfig: JsonField, private val additionalProperties: Map, ) { @@ -13946,7 +15865,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun bulkConfig(): BulkConfig = bulkConfig.getRequired("bulk_config") + fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = + thresholdTotalAmountConfig.getRequired("threshold_total_amount_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -14005,13 +15925,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("bulk_config") @ExcludeMissing fun _bulkConfig() = bulkConfig + @JsonProperty("threshold_total_amount_config") + @ExcludeMissing + fun _thresholdTotalAmountConfig() = thresholdTotalAmountConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): BulkPrice = apply { + fun validate(): ThresholdTotalAmountPrice = apply { if (!validated) { metadata().validate() id() @@ -14035,7 +15957,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - bulkConfig().validate() + thresholdTotalAmountConfig().validate() validated = true } } @@ -14073,35 +15995,38 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var bulkConfig: JsonField = JsonMissing.of() + private var thresholdTotalAmountConfig: JsonField = + JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bulkPrice: BulkPrice) = apply { - this.metadata = bulkPrice.metadata - this.id = bulkPrice.id - this.name = bulkPrice.name - this.externalPriceId = bulkPrice.externalPriceId - this.priceType = bulkPrice.priceType - this.modelType = bulkPrice.modelType - this.createdAt = bulkPrice.createdAt - this.cadence = bulkPrice.cadence - this.billingCycleConfiguration = bulkPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = bulkPrice.invoicingCycleConfiguration - this.billableMetric = bulkPrice.billableMetric - this.fixedPriceQuantity = bulkPrice.fixedPriceQuantity - this.planPhaseOrder = bulkPrice.planPhaseOrder - this.currency = bulkPrice.currency - this.conversionRate = bulkPrice.conversionRate - this.item = bulkPrice.item - this.creditAllocation = bulkPrice.creditAllocation - this.discount = bulkPrice.discount - this.minimum = bulkPrice.minimum - this.minimumAmount = bulkPrice.minimumAmount - this.maximum = bulkPrice.maximum - this.maximumAmount = bulkPrice.maximumAmount - this.bulkConfig = bulkPrice.bulkConfig - additionalProperties(bulkPrice.additionalProperties) + internal fun from(thresholdTotalAmountPrice: ThresholdTotalAmountPrice) = apply { + this.metadata = thresholdTotalAmountPrice.metadata + this.id = thresholdTotalAmountPrice.id + this.name = thresholdTotalAmountPrice.name + this.externalPriceId = thresholdTotalAmountPrice.externalPriceId + this.priceType = thresholdTotalAmountPrice.priceType + this.modelType = thresholdTotalAmountPrice.modelType + this.createdAt = thresholdTotalAmountPrice.createdAt + this.cadence = thresholdTotalAmountPrice.cadence + this.billingCycleConfiguration = thresholdTotalAmountPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = + thresholdTotalAmountPrice.invoicingCycleConfiguration + this.billableMetric = thresholdTotalAmountPrice.billableMetric + this.fixedPriceQuantity = thresholdTotalAmountPrice.fixedPriceQuantity + this.planPhaseOrder = thresholdTotalAmountPrice.planPhaseOrder + this.currency = thresholdTotalAmountPrice.currency + this.conversionRate = thresholdTotalAmountPrice.conversionRate + this.item = thresholdTotalAmountPrice.item + this.creditAllocation = thresholdTotalAmountPrice.creditAllocation + this.discount = thresholdTotalAmountPrice.discount + this.minimum = thresholdTotalAmountPrice.minimum + this.minimumAmount = thresholdTotalAmountPrice.minimumAmount + this.maximum = thresholdTotalAmountPrice.maximum + this.maximumAmount = thresholdTotalAmountPrice.maximumAmount + this.thresholdTotalAmountConfig = + thresholdTotalAmountPrice.thresholdTotalAmountConfig + additionalProperties(thresholdTotalAmountPrice.additionalProperties) } /** @@ -14276,13 +16201,14 @@ private constructor( this.maximumAmount = maximumAmount } - fun bulkConfig(bulkConfig: BulkConfig) = bulkConfig(JsonField.of(bulkConfig)) + fun thresholdTotalAmountConfig(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = + thresholdTotalAmountConfig(JsonField.of(thresholdTotalAmountConfig)) - @JsonProperty("bulk_config") + @JsonProperty("threshold_total_amount_config") @ExcludeMissing - fun bulkConfig(bulkConfig: JsonField) = apply { - this.bulkConfig = bulkConfig - } + fun thresholdTotalAmountConfig( + thresholdTotalAmountConfig: JsonField + ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -14298,8 +16224,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): BulkPrice = - BulkPrice( + fun build(): ThresholdTotalAmountPrice = + ThresholdTotalAmountPrice( metadata, id, name, @@ -14322,7 +16248,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - bulkConfig, + thresholdTotalAmountConfig, additionalProperties.toImmutable(), ) } @@ -14582,220 +16508,6 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = BulkConfig.Builder::class) - @NoAutoDetect - class BulkConfig - private constructor( - private val tiers: JsonField>, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - /** Bulk tiers for rating based on total usage volume */ - fun tiers(): List = tiers.getRequired("tiers") - - /** Bulk tiers for rating based on total usage volume */ - @JsonProperty("tiers") @ExcludeMissing fun _tiers() = tiers - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): BulkConfig = apply { - if (!validated) { - tiers().forEach { it.validate() } - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var tiers: JsonField> = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(bulkConfig: BulkConfig) = apply { - this.tiers = bulkConfig.tiers - additionalProperties(bulkConfig.additionalProperties) - } - - /** Bulk tiers for rating based on total usage volume */ - fun tiers(tiers: List) = tiers(JsonField.of(tiers)) - - /** Bulk tiers for rating based on total usage volume */ - @JsonProperty("tiers") - @ExcludeMissing - fun tiers(tiers: JsonField>) = apply { this.tiers = tiers } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): BulkConfig = - BulkConfig(tiers.map { it.toImmutable() }, additionalProperties.toImmutable()) - } - - @JsonDeserialize(builder = Tier.Builder::class) - @NoAutoDetect - class Tier - private constructor( - private val maximumUnits: JsonField, - private val unitAmount: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - /** Upper bound for this tier */ - fun maximumUnits(): Optional = - Optional.ofNullable(maximumUnits.getNullable("maximum_units")) - - /** Amount per unit */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") - - /** Upper bound for this tier */ - @JsonProperty("maximum_units") @ExcludeMissing fun _maximumUnits() = maximumUnits - - /** Amount per unit */ - @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): Tier = apply { - if (!validated) { - maximumUnits() - unitAmount() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var maximumUnits: JsonField = JsonMissing.of() - private var unitAmount: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(tier: Tier) = apply { - this.maximumUnits = tier.maximumUnits - this.unitAmount = tier.unitAmount - additionalProperties(tier.additionalProperties) - } - - /** Upper bound for this tier */ - fun maximumUnits(maximumUnits: Double) = - maximumUnits(JsonField.of(maximumUnits)) - - /** Upper bound for this tier */ - @JsonProperty("maximum_units") - @ExcludeMissing - fun maximumUnits(maximumUnits: JsonField) = apply { - this.maximumUnits = maximumUnits - } - - /** Amount per unit */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - - /** Amount per unit */ - @JsonProperty("unit_amount") - @ExcludeMissing - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): Tier = - Tier( - maximumUnits, - unitAmount, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Tier && this.maximumUnits == other.maximumUnits && this.unitAmount == other.unitAmount && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(maximumUnits, unitAmount, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "Tier{maximumUnits=$maximumUnits, unitAmount=$unitAmount, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is BulkConfig && this.tiers == other.tiers && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(tiers, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "BulkConfig{tiers=$tiers, additionalProperties=$additionalProperties}" - } - class Cadence @JsonCreator private constructor( @@ -15634,29 +17346,30 @@ private constructor( companion object { - @JvmField val BULK = ModelType(JsonField.of("bulk")) + @JvmField + val THRESHOLD_TOTAL_AMOUNT = ModelType(JsonField.of("threshold_total_amount")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - BULK, + THRESHOLD_TOTAL_AMOUNT, } enum class Value { - BULK, + THRESHOLD_TOTAL_AMOUNT, _UNKNOWN, } fun value(): Value = when (this) { - BULK -> Value.BULK + THRESHOLD_TOTAL_AMOUNT -> Value.THRESHOLD_TOTAL_AMOUNT else -> Value._UNKNOWN } fun known(): Known = when (this) { - BULK -> Known.BULK + THRESHOLD_TOTAL_AMOUNT -> Known.THRESHOLD_TOTAL_AMOUNT else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -15720,30 +17433,105 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } + @JsonDeserialize(builder = ThresholdTotalAmountConfig.Builder::class) + @NoAutoDetect + class ThresholdTotalAmountConfig + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): ThresholdTotalAmountConfig = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = apply { + additionalProperties(thresholdTotalAmountConfig.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): ThresholdTotalAmountConfig = + ThresholdTotalAmountConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ThresholdTotalAmountConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "ThresholdTotalAmountConfig{additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is BulkPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.bulkConfig == other.bulkConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ThresholdTotalAmountPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, bulkConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, thresholdTotalAmountConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "BulkPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, bulkConfig=$bulkConfig, additionalProperties=$additionalProperties}" + "ThresholdTotalAmountPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = ThresholdTotalAmountPrice.Builder::class) + @JsonDeserialize(builder = TieredPackagePrice.Builder::class) @NoAutoDetect - class ThresholdTotalAmountPrice + class TieredPackagePrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -15767,7 +17555,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val thresholdTotalAmountConfig: JsonField, + private val tieredPackageConfig: JsonField, private val additionalProperties: Map, ) { @@ -15834,8 +17622,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun thresholdTotalAmountConfig(): ThresholdTotalAmountConfig = - thresholdTotalAmountConfig.getRequired("threshold_total_amount_config") + fun tieredPackageConfig(): TieredPackageConfig = + tieredPackageConfig.getRequired("tiered_package_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -15894,15 +17682,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("threshold_total_amount_config") + @JsonProperty("tiered_package_config") @ExcludeMissing - fun _thresholdTotalAmountConfig() = thresholdTotalAmountConfig + fun _tieredPackageConfig() = tieredPackageConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): ThresholdTotalAmountPrice = apply { + fun validate(): TieredPackagePrice = apply { if (!validated) { metadata().validate() id() @@ -15926,7 +17714,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - thresholdTotalAmountConfig().validate() + tieredPackageConfig().validate() validated = true } } @@ -15964,38 +17752,35 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var thresholdTotalAmountConfig: JsonField = - JsonMissing.of() + private var tieredPackageConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(thresholdTotalAmountPrice: ThresholdTotalAmountPrice) = apply { - this.metadata = thresholdTotalAmountPrice.metadata - this.id = thresholdTotalAmountPrice.id - this.name = thresholdTotalAmountPrice.name - this.externalPriceId = thresholdTotalAmountPrice.externalPriceId - this.priceType = thresholdTotalAmountPrice.priceType - this.modelType = thresholdTotalAmountPrice.modelType - this.createdAt = thresholdTotalAmountPrice.createdAt - this.cadence = thresholdTotalAmountPrice.cadence - this.billingCycleConfiguration = thresholdTotalAmountPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = - thresholdTotalAmountPrice.invoicingCycleConfiguration - this.billableMetric = thresholdTotalAmountPrice.billableMetric - this.fixedPriceQuantity = thresholdTotalAmountPrice.fixedPriceQuantity - this.planPhaseOrder = thresholdTotalAmountPrice.planPhaseOrder - this.currency = thresholdTotalAmountPrice.currency - this.conversionRate = thresholdTotalAmountPrice.conversionRate - this.item = thresholdTotalAmountPrice.item - this.creditAllocation = thresholdTotalAmountPrice.creditAllocation - this.discount = thresholdTotalAmountPrice.discount - this.minimum = thresholdTotalAmountPrice.minimum - this.minimumAmount = thresholdTotalAmountPrice.minimumAmount - this.maximum = thresholdTotalAmountPrice.maximum - this.maximumAmount = thresholdTotalAmountPrice.maximumAmount - this.thresholdTotalAmountConfig = - thresholdTotalAmountPrice.thresholdTotalAmountConfig - additionalProperties(thresholdTotalAmountPrice.additionalProperties) + internal fun from(tieredPackagePrice: TieredPackagePrice) = apply { + this.metadata = tieredPackagePrice.metadata + this.id = tieredPackagePrice.id + this.name = tieredPackagePrice.name + this.externalPriceId = tieredPackagePrice.externalPriceId + this.priceType = tieredPackagePrice.priceType + this.modelType = tieredPackagePrice.modelType + this.createdAt = tieredPackagePrice.createdAt + this.cadence = tieredPackagePrice.cadence + this.billingCycleConfiguration = tieredPackagePrice.billingCycleConfiguration + this.invoicingCycleConfiguration = tieredPackagePrice.invoicingCycleConfiguration + this.billableMetric = tieredPackagePrice.billableMetric + this.fixedPriceQuantity = tieredPackagePrice.fixedPriceQuantity + this.planPhaseOrder = tieredPackagePrice.planPhaseOrder + this.currency = tieredPackagePrice.currency + this.conversionRate = tieredPackagePrice.conversionRate + this.item = tieredPackagePrice.item + this.creditAllocation = tieredPackagePrice.creditAllocation + this.discount = tieredPackagePrice.discount + this.minimum = tieredPackagePrice.minimum + this.minimumAmount = tieredPackagePrice.minimumAmount + this.maximum = tieredPackagePrice.maximum + this.maximumAmount = tieredPackagePrice.maximumAmount + this.tieredPackageConfig = tieredPackagePrice.tieredPackageConfig + additionalProperties(tieredPackagePrice.additionalProperties) } /** @@ -16170,14 +17955,14 @@ private constructor( this.maximumAmount = maximumAmount } - fun thresholdTotalAmountConfig(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = - thresholdTotalAmountConfig(JsonField.of(thresholdTotalAmountConfig)) + fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = + tieredPackageConfig(JsonField.of(tieredPackageConfig)) - @JsonProperty("threshold_total_amount_config") + @JsonProperty("tiered_package_config") @ExcludeMissing - fun thresholdTotalAmountConfig( - thresholdTotalAmountConfig: JsonField - ) = apply { this.thresholdTotalAmountConfig = thresholdTotalAmountConfig } + fun tieredPackageConfig(tieredPackageConfig: JsonField) = apply { + this.tieredPackageConfig = tieredPackageConfig + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -16193,8 +17978,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ThresholdTotalAmountPrice = - ThresholdTotalAmountPrice( + fun build(): TieredPackagePrice = + TieredPackagePrice( metadata, id, name, @@ -16217,7 +18002,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - thresholdTotalAmountConfig, + tieredPackageConfig, additionalProperties.toImmutable(), ) } @@ -17315,30 +19100,29 @@ private constructor( companion object { - @JvmField - val THRESHOLD_TOTAL_AMOUNT = ModelType(JsonField.of("threshold_total_amount")) + @JvmField val TIERED_PACKAGE = ModelType(JsonField.of("tiered_package")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - THRESHOLD_TOTAL_AMOUNT, + TIERED_PACKAGE, } enum class Value { - THRESHOLD_TOTAL_AMOUNT, + TIERED_PACKAGE, _UNKNOWN, } fun value(): Value = when (this) { - THRESHOLD_TOTAL_AMOUNT -> Value.THRESHOLD_TOTAL_AMOUNT + TIERED_PACKAGE -> Value.TIERED_PACKAGE else -> Value._UNKNOWN } fun known(): Known = when (this) { - THRESHOLD_TOTAL_AMOUNT -> Known.THRESHOLD_TOTAL_AMOUNT + TIERED_PACKAGE -> Known.TIERED_PACKAGE else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -17402,9 +19186,9 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } - @JsonDeserialize(builder = ThresholdTotalAmountConfig.Builder::class) + @JsonDeserialize(builder = TieredPackageConfig.Builder::class) @NoAutoDetect - class ThresholdTotalAmountConfig + class TieredPackageConfig private constructor( private val additionalProperties: Map, ) { @@ -17415,7 +19199,7 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): ThresholdTotalAmountConfig = apply { + fun validate(): TieredPackageConfig = apply { if (!validated) { validated = true } @@ -17433,8 +19217,8 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(thresholdTotalAmountConfig: ThresholdTotalAmountConfig) = apply { - additionalProperties(thresholdTotalAmountConfig.additionalProperties) + internal fun from(tieredPackageConfig: TieredPackageConfig) = apply { + additionalProperties(tieredPackageConfig.additionalProperties) } fun additionalProperties(additionalProperties: Map) = apply { @@ -17452,8 +19236,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): ThresholdTotalAmountConfig = - ThresholdTotalAmountConfig(additionalProperties.toImmutable()) + fun build(): TieredPackageConfig = + TieredPackageConfig(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -17461,7 +19245,7 @@ private constructor( return true } - return /* spotless:off */ other is ThresholdTotalAmountConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredPackageConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 @@ -17474,7 +19258,7 @@ private constructor( } override fun toString() = - "ThresholdTotalAmountConfig{additionalProperties=$additionalProperties}" + "TieredPackageConfig{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -17482,25 +19266,25 @@ private constructor( return true } - return /* spotless:off */ other is ThresholdTotalAmountPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.thresholdTotalAmountConfig == other.thresholdTotalAmountConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredPackagePrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.tieredPackageConfig == other.tieredPackageConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, thresholdTotalAmountConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredPackageConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "ThresholdTotalAmountPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, thresholdTotalAmountConfig=$thresholdTotalAmountConfig, additionalProperties=$additionalProperties}" + "TieredPackagePrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredPackageConfig=$tieredPackageConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = TieredPackagePrice.Builder::class) + @JsonDeserialize(builder = GroupedTieredPrice.Builder::class) @NoAutoDetect - class TieredPackagePrice + class GroupedTieredPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -17524,7 +19308,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val tieredPackageConfig: JsonField, + private val groupedTieredConfig: JsonField, private val additionalProperties: Map, ) { @@ -17591,8 +19375,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun tieredPackageConfig(): TieredPackageConfig = - tieredPackageConfig.getRequired("tiered_package_config") + fun groupedTieredConfig(): GroupedTieredConfig = + groupedTieredConfig.getRequired("grouped_tiered_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -17651,15 +19435,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("tiered_package_config") + @JsonProperty("grouped_tiered_config") @ExcludeMissing - fun _tieredPackageConfig() = tieredPackageConfig + fun _groupedTieredConfig() = groupedTieredConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): TieredPackagePrice = apply { + fun validate(): GroupedTieredPrice = apply { if (!validated) { metadata().validate() id() @@ -17683,7 +19467,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - tieredPackageConfig().validate() + groupedTieredConfig().validate() validated = true } } @@ -17721,35 +19505,35 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var tieredPackageConfig: JsonField = JsonMissing.of() + private var groupedTieredConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredPackagePrice: TieredPackagePrice) = apply { - this.metadata = tieredPackagePrice.metadata - this.id = tieredPackagePrice.id - this.name = tieredPackagePrice.name - this.externalPriceId = tieredPackagePrice.externalPriceId - this.priceType = tieredPackagePrice.priceType - this.modelType = tieredPackagePrice.modelType - this.createdAt = tieredPackagePrice.createdAt - this.cadence = tieredPackagePrice.cadence - this.billingCycleConfiguration = tieredPackagePrice.billingCycleConfiguration - this.invoicingCycleConfiguration = tieredPackagePrice.invoicingCycleConfiguration - this.billableMetric = tieredPackagePrice.billableMetric - this.fixedPriceQuantity = tieredPackagePrice.fixedPriceQuantity - this.planPhaseOrder = tieredPackagePrice.planPhaseOrder - this.currency = tieredPackagePrice.currency - this.conversionRate = tieredPackagePrice.conversionRate - this.item = tieredPackagePrice.item - this.creditAllocation = tieredPackagePrice.creditAllocation - this.discount = tieredPackagePrice.discount - this.minimum = tieredPackagePrice.minimum - this.minimumAmount = tieredPackagePrice.minimumAmount - this.maximum = tieredPackagePrice.maximum - this.maximumAmount = tieredPackagePrice.maximumAmount - this.tieredPackageConfig = tieredPackagePrice.tieredPackageConfig - additionalProperties(tieredPackagePrice.additionalProperties) + internal fun from(groupedTieredPrice: GroupedTieredPrice) = apply { + this.metadata = groupedTieredPrice.metadata + this.id = groupedTieredPrice.id + this.name = groupedTieredPrice.name + this.externalPriceId = groupedTieredPrice.externalPriceId + this.priceType = groupedTieredPrice.priceType + this.modelType = groupedTieredPrice.modelType + this.createdAt = groupedTieredPrice.createdAt + this.cadence = groupedTieredPrice.cadence + this.billingCycleConfiguration = groupedTieredPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = groupedTieredPrice.invoicingCycleConfiguration + this.billableMetric = groupedTieredPrice.billableMetric + this.fixedPriceQuantity = groupedTieredPrice.fixedPriceQuantity + this.planPhaseOrder = groupedTieredPrice.planPhaseOrder + this.currency = groupedTieredPrice.currency + this.conversionRate = groupedTieredPrice.conversionRate + this.item = groupedTieredPrice.item + this.creditAllocation = groupedTieredPrice.creditAllocation + this.discount = groupedTieredPrice.discount + this.minimum = groupedTieredPrice.minimum + this.minimumAmount = groupedTieredPrice.minimumAmount + this.maximum = groupedTieredPrice.maximum + this.maximumAmount = groupedTieredPrice.maximumAmount + this.groupedTieredConfig = groupedTieredPrice.groupedTieredConfig + additionalProperties(groupedTieredPrice.additionalProperties) } /** @@ -17924,13 +19708,13 @@ private constructor( this.maximumAmount = maximumAmount } - fun tieredPackageConfig(tieredPackageConfig: TieredPackageConfig) = - tieredPackageConfig(JsonField.of(tieredPackageConfig)) + fun groupedTieredConfig(groupedTieredConfig: GroupedTieredConfig) = + groupedTieredConfig(JsonField.of(groupedTieredConfig)) - @JsonProperty("tiered_package_config") + @JsonProperty("grouped_tiered_config") @ExcludeMissing - fun tieredPackageConfig(tieredPackageConfig: JsonField) = apply { - this.tieredPackageConfig = tieredPackageConfig + fun groupedTieredConfig(groupedTieredConfig: JsonField) = apply { + this.groupedTieredConfig = groupedTieredConfig } fun additionalProperties(additionalProperties: Map) = apply { @@ -17947,8 +19731,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): TieredPackagePrice = - TieredPackagePrice( + fun build(): GroupedTieredPrice = + GroupedTieredPrice( metadata, id, name, @@ -17971,7 +19755,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - tieredPackageConfig, + groupedTieredConfig, additionalProperties.toImmutable(), ) } @@ -18422,6 +20206,81 @@ private constructor( "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" } + @JsonDeserialize(builder = GroupedTieredConfig.Builder::class) + @NoAutoDetect + class GroupedTieredConfig + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): GroupedTieredConfig = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(groupedTieredConfig: GroupedTieredConfig) = apply { + additionalProperties(groupedTieredConfig.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): GroupedTieredConfig = + GroupedTieredConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is GroupedTieredConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "GroupedTieredConfig{additionalProperties=$additionalProperties}" + } + @JsonDeserialize(builder = InvoicingCycleConfiguration.Builder::class) @NoAutoDetect class InvoicingCycleConfiguration @@ -19069,29 +20928,29 @@ private constructor( companion object { - @JvmField val TIERED_PACKAGE = ModelType(JsonField.of("tiered_package")) + @JvmField val GROUPED_TIERED = ModelType(JsonField.of("grouped_tiered")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - TIERED_PACKAGE, + GROUPED_TIERED, } enum class Value { - TIERED_PACKAGE, + GROUPED_TIERED, _UNKNOWN, } fun value(): Value = when (this) { - TIERED_PACKAGE -> Value.TIERED_PACKAGE + GROUPED_TIERED -> Value.GROUPED_TIERED else -> Value._UNKNOWN } fun known(): Known = when (this) { - TIERED_PACKAGE -> Known.TIERED_PACKAGE + GROUPED_TIERED -> Known.GROUPED_TIERED else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -19155,105 +21014,30 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } - @JsonDeserialize(builder = TieredPackageConfig.Builder::class) - @NoAutoDetect - class TieredPackageConfig - private constructor( - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): TieredPackageConfig = apply { - if (!validated) { - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(tieredPackageConfig: TieredPackageConfig) = apply { - additionalProperties(tieredPackageConfig.additionalProperties) - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): TieredPackageConfig = - TieredPackageConfig(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is TieredPackageConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "TieredPackageConfig{additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is TieredPackagePrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.tieredPackageConfig == other.tieredPackageConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTieredPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.groupedTieredConfig == other.groupedTieredConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredPackageConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedTieredConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "TieredPackagePrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredPackageConfig=$tieredPackageConfig, additionalProperties=$additionalProperties}" + "GroupedTieredPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedTieredConfig=$groupedTieredConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = GroupedTieredPrice.Builder::class) + @JsonDeserialize(builder = TieredWithMinimumPrice.Builder::class) @NoAutoDetect - class GroupedTieredPrice + class TieredWithMinimumPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -19277,7 +21061,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val groupedTieredConfig: JsonField, + private val tieredWithMinimumConfig: JsonField, private val additionalProperties: Map, ) { @@ -19344,8 +21128,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun groupedTieredConfig(): GroupedTieredConfig = - groupedTieredConfig.getRequired("grouped_tiered_config") + fun tieredWithMinimumConfig(): TieredWithMinimumConfig = + tieredWithMinimumConfig.getRequired("tiered_with_minimum_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -19404,15 +21188,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("grouped_tiered_config") + @JsonProperty("tiered_with_minimum_config") @ExcludeMissing - fun _groupedTieredConfig() = groupedTieredConfig + fun _tieredWithMinimumConfig() = tieredWithMinimumConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): GroupedTieredPrice = apply { + fun validate(): TieredWithMinimumPrice = apply { if (!validated) { metadata().validate() id() @@ -19436,7 +21220,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - groupedTieredConfig().validate() + tieredWithMinimumConfig().validate() validated = true } } @@ -19474,35 +21258,37 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var groupedTieredConfig: JsonField = JsonMissing.of() + private var tieredWithMinimumConfig: JsonField = + JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedTieredPrice: GroupedTieredPrice) = apply { - this.metadata = groupedTieredPrice.metadata - this.id = groupedTieredPrice.id - this.name = groupedTieredPrice.name - this.externalPriceId = groupedTieredPrice.externalPriceId - this.priceType = groupedTieredPrice.priceType - this.modelType = groupedTieredPrice.modelType - this.createdAt = groupedTieredPrice.createdAt - this.cadence = groupedTieredPrice.cadence - this.billingCycleConfiguration = groupedTieredPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = groupedTieredPrice.invoicingCycleConfiguration - this.billableMetric = groupedTieredPrice.billableMetric - this.fixedPriceQuantity = groupedTieredPrice.fixedPriceQuantity - this.planPhaseOrder = groupedTieredPrice.planPhaseOrder - this.currency = groupedTieredPrice.currency - this.conversionRate = groupedTieredPrice.conversionRate - this.item = groupedTieredPrice.item - this.creditAllocation = groupedTieredPrice.creditAllocation - this.discount = groupedTieredPrice.discount - this.minimum = groupedTieredPrice.minimum - this.minimumAmount = groupedTieredPrice.minimumAmount - this.maximum = groupedTieredPrice.maximum - this.maximumAmount = groupedTieredPrice.maximumAmount - this.groupedTieredConfig = groupedTieredPrice.groupedTieredConfig - additionalProperties(groupedTieredPrice.additionalProperties) + internal fun from(tieredWithMinimumPrice: TieredWithMinimumPrice) = apply { + this.metadata = tieredWithMinimumPrice.metadata + this.id = tieredWithMinimumPrice.id + this.name = tieredWithMinimumPrice.name + this.externalPriceId = tieredWithMinimumPrice.externalPriceId + this.priceType = tieredWithMinimumPrice.priceType + this.modelType = tieredWithMinimumPrice.modelType + this.createdAt = tieredWithMinimumPrice.createdAt + this.cadence = tieredWithMinimumPrice.cadence + this.billingCycleConfiguration = tieredWithMinimumPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = + tieredWithMinimumPrice.invoicingCycleConfiguration + this.billableMetric = tieredWithMinimumPrice.billableMetric + this.fixedPriceQuantity = tieredWithMinimumPrice.fixedPriceQuantity + this.planPhaseOrder = tieredWithMinimumPrice.planPhaseOrder + this.currency = tieredWithMinimumPrice.currency + this.conversionRate = tieredWithMinimumPrice.conversionRate + this.item = tieredWithMinimumPrice.item + this.creditAllocation = tieredWithMinimumPrice.creditAllocation + this.discount = tieredWithMinimumPrice.discount + this.minimum = tieredWithMinimumPrice.minimum + this.minimumAmount = tieredWithMinimumPrice.minimumAmount + this.maximum = tieredWithMinimumPrice.maximum + this.maximumAmount = tieredWithMinimumPrice.maximumAmount + this.tieredWithMinimumConfig = tieredWithMinimumPrice.tieredWithMinimumConfig + additionalProperties(tieredWithMinimumPrice.additionalProperties) } /** @@ -19677,14 +21463,14 @@ private constructor( this.maximumAmount = maximumAmount } - fun groupedTieredConfig(groupedTieredConfig: GroupedTieredConfig) = - groupedTieredConfig(JsonField.of(groupedTieredConfig)) + fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = + tieredWithMinimumConfig(JsonField.of(tieredWithMinimumConfig)) - @JsonProperty("grouped_tiered_config") + @JsonProperty("tiered_with_minimum_config") @ExcludeMissing - fun groupedTieredConfig(groupedTieredConfig: JsonField) = apply { - this.groupedTieredConfig = groupedTieredConfig - } + fun tieredWithMinimumConfig( + tieredWithMinimumConfig: JsonField + ) = apply { this.tieredWithMinimumConfig = tieredWithMinimumConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -19700,8 +21486,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): GroupedTieredPrice = - GroupedTieredPrice( + fun build(): TieredWithMinimumPrice = + TieredWithMinimumPrice( metadata, id, name, @@ -19724,7 +21510,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - groupedTieredConfig, + tieredWithMinimumConfig, additionalProperties.toImmutable(), ) } @@ -20175,81 +21961,6 @@ private constructor( "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = GroupedTieredConfig.Builder::class) - @NoAutoDetect - class GroupedTieredConfig - private constructor( - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): GroupedTieredConfig = apply { - if (!validated) { - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(groupedTieredConfig: GroupedTieredConfig) = apply { - additionalProperties(groupedTieredConfig.additionalProperties) - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): GroupedTieredConfig = - GroupedTieredConfig(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is GroupedTieredConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "GroupedTieredConfig{additionalProperties=$additionalProperties}" - } - @JsonDeserialize(builder = InvoicingCycleConfiguration.Builder::class) @NoAutoDetect class InvoicingCycleConfiguration @@ -20897,29 +22608,29 @@ private constructor( companion object { - @JvmField val GROUPED_TIERED = ModelType(JsonField.of("grouped_tiered")) + @JvmField val TIERED_WITH_MINIMUM = ModelType(JsonField.of("tiered_with_minimum")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - GROUPED_TIERED, + TIERED_WITH_MINIMUM, } enum class Value { - GROUPED_TIERED, + TIERED_WITH_MINIMUM, _UNKNOWN, } fun value(): Value = when (this) { - GROUPED_TIERED -> Value.GROUPED_TIERED + TIERED_WITH_MINIMUM -> Value.TIERED_WITH_MINIMUM else -> Value._UNKNOWN } fun known(): Known = when (this) { - GROUPED_TIERED -> Known.GROUPED_TIERED + TIERED_WITH_MINIMUM -> Known.TIERED_WITH_MINIMUM else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -20983,30 +22694,105 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } + @JsonDeserialize(builder = TieredWithMinimumConfig.Builder::class) + @NoAutoDetect + class TieredWithMinimumConfig + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): TieredWithMinimumConfig = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tieredWithMinimumConfig: TieredWithMinimumConfig) = apply { + additionalProperties(tieredWithMinimumConfig.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): TieredWithMinimumConfig = + TieredWithMinimumConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TieredWithMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "TieredWithMinimumConfig{additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is GroupedTieredPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.groupedTieredConfig == other.groupedTieredConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredWithMinimumPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.tieredWithMinimumConfig == other.tieredWithMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedTieredConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredWithMinimumConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "GroupedTieredPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedTieredConfig=$groupedTieredConfig, additionalProperties=$additionalProperties}" + "TieredWithMinimumPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredWithMinimumConfig=$tieredWithMinimumConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = TieredWithMinimumPrice.Builder::class) + @JsonDeserialize(builder = TieredPackageWithMinimumPrice.Builder::class) @NoAutoDetect - class TieredWithMinimumPrice + class TieredPackageWithMinimumPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -21030,7 +22816,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val tieredWithMinimumConfig: JsonField, + private val tieredPackageWithMinimumConfig: JsonField, private val additionalProperties: Map, ) { @@ -21097,8 +22883,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun tieredWithMinimumConfig(): TieredWithMinimumConfig = - tieredWithMinimumConfig.getRequired("tiered_with_minimum_config") + fun tieredPackageWithMinimumConfig(): TieredPackageWithMinimumConfig = + tieredPackageWithMinimumConfig.getRequired("tiered_package_with_minimum_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -21157,15 +22943,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("tiered_with_minimum_config") + @JsonProperty("tiered_package_with_minimum_config") @ExcludeMissing - fun _tieredWithMinimumConfig() = tieredWithMinimumConfig + fun _tieredPackageWithMinimumConfig() = tieredPackageWithMinimumConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): TieredWithMinimumPrice = apply { + fun validate(): TieredPackageWithMinimumPrice = apply { if (!validated) { metadata().validate() id() @@ -21189,7 +22975,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - tieredWithMinimumConfig().validate() + tieredPackageWithMinimumConfig().validate() validated = true } } @@ -21227,38 +23013,41 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var tieredWithMinimumConfig: JsonField = + private var tieredPackageWithMinimumConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredWithMinimumPrice: TieredWithMinimumPrice) = apply { - this.metadata = tieredWithMinimumPrice.metadata - this.id = tieredWithMinimumPrice.id - this.name = tieredWithMinimumPrice.name - this.externalPriceId = tieredWithMinimumPrice.externalPriceId - this.priceType = tieredWithMinimumPrice.priceType - this.modelType = tieredWithMinimumPrice.modelType - this.createdAt = tieredWithMinimumPrice.createdAt - this.cadence = tieredWithMinimumPrice.cadence - this.billingCycleConfiguration = tieredWithMinimumPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = - tieredWithMinimumPrice.invoicingCycleConfiguration - this.billableMetric = tieredWithMinimumPrice.billableMetric - this.fixedPriceQuantity = tieredWithMinimumPrice.fixedPriceQuantity - this.planPhaseOrder = tieredWithMinimumPrice.planPhaseOrder - this.currency = tieredWithMinimumPrice.currency - this.conversionRate = tieredWithMinimumPrice.conversionRate - this.item = tieredWithMinimumPrice.item - this.creditAllocation = tieredWithMinimumPrice.creditAllocation - this.discount = tieredWithMinimumPrice.discount - this.minimum = tieredWithMinimumPrice.minimum - this.minimumAmount = tieredWithMinimumPrice.minimumAmount - this.maximum = tieredWithMinimumPrice.maximum - this.maximumAmount = tieredWithMinimumPrice.maximumAmount - this.tieredWithMinimumConfig = tieredWithMinimumPrice.tieredWithMinimumConfig - additionalProperties(tieredWithMinimumPrice.additionalProperties) - } + internal fun from(tieredPackageWithMinimumPrice: TieredPackageWithMinimumPrice) = + apply { + this.metadata = tieredPackageWithMinimumPrice.metadata + this.id = tieredPackageWithMinimumPrice.id + this.name = tieredPackageWithMinimumPrice.name + this.externalPriceId = tieredPackageWithMinimumPrice.externalPriceId + this.priceType = tieredPackageWithMinimumPrice.priceType + this.modelType = tieredPackageWithMinimumPrice.modelType + this.createdAt = tieredPackageWithMinimumPrice.createdAt + this.cadence = tieredPackageWithMinimumPrice.cadence + this.billingCycleConfiguration = + tieredPackageWithMinimumPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = + tieredPackageWithMinimumPrice.invoicingCycleConfiguration + this.billableMetric = tieredPackageWithMinimumPrice.billableMetric + this.fixedPriceQuantity = tieredPackageWithMinimumPrice.fixedPriceQuantity + this.planPhaseOrder = tieredPackageWithMinimumPrice.planPhaseOrder + this.currency = tieredPackageWithMinimumPrice.currency + this.conversionRate = tieredPackageWithMinimumPrice.conversionRate + this.item = tieredPackageWithMinimumPrice.item + this.creditAllocation = tieredPackageWithMinimumPrice.creditAllocation + this.discount = tieredPackageWithMinimumPrice.discount + this.minimum = tieredPackageWithMinimumPrice.minimum + this.minimumAmount = tieredPackageWithMinimumPrice.minimumAmount + this.maximum = tieredPackageWithMinimumPrice.maximum + this.maximumAmount = tieredPackageWithMinimumPrice.maximumAmount + this.tieredPackageWithMinimumConfig = + tieredPackageWithMinimumPrice.tieredPackageWithMinimumConfig + additionalProperties(tieredPackageWithMinimumPrice.additionalProperties) + } /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -21432,14 +23221,15 @@ private constructor( this.maximumAmount = maximumAmount } - fun tieredWithMinimumConfig(tieredWithMinimumConfig: TieredWithMinimumConfig) = - tieredWithMinimumConfig(JsonField.of(tieredWithMinimumConfig)) + fun tieredPackageWithMinimumConfig( + tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig + ) = tieredPackageWithMinimumConfig(JsonField.of(tieredPackageWithMinimumConfig)) - @JsonProperty("tiered_with_minimum_config") + @JsonProperty("tiered_package_with_minimum_config") @ExcludeMissing - fun tieredWithMinimumConfig( - tieredWithMinimumConfig: JsonField - ) = apply { this.tieredWithMinimumConfig = tieredWithMinimumConfig } + fun tieredPackageWithMinimumConfig( + tieredPackageWithMinimumConfig: JsonField + ) = apply { this.tieredPackageWithMinimumConfig = tieredPackageWithMinimumConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -21455,8 +23245,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): TieredWithMinimumPrice = - TieredWithMinimumPrice( + fun build(): TieredPackageWithMinimumPrice = + TieredPackageWithMinimumPrice( metadata, id, name, @@ -21479,7 +23269,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - tieredWithMinimumConfig, + tieredPackageWithMinimumConfig, additionalProperties.toImmutable(), ) } @@ -22577,29 +24367,31 @@ private constructor( companion object { - @JvmField val TIERED_WITH_MINIMUM = ModelType(JsonField.of("tiered_with_minimum")) + @JvmField + val TIERED_PACKAGE_WITH_MINIMUM = + ModelType(JsonField.of("tiered_package_with_minimum")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - TIERED_WITH_MINIMUM, + TIERED_PACKAGE_WITH_MINIMUM, } enum class Value { - TIERED_WITH_MINIMUM, + TIERED_PACKAGE_WITH_MINIMUM, _UNKNOWN, } fun value(): Value = when (this) { - TIERED_WITH_MINIMUM -> Value.TIERED_WITH_MINIMUM + TIERED_PACKAGE_WITH_MINIMUM -> Value.TIERED_PACKAGE_WITH_MINIMUM else -> Value._UNKNOWN } fun known(): Known = when (this) { - TIERED_WITH_MINIMUM -> Known.TIERED_WITH_MINIMUM + TIERED_PACKAGE_WITH_MINIMUM -> Known.TIERED_PACKAGE_WITH_MINIMUM else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -22663,9 +24455,9 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } - @JsonDeserialize(builder = TieredWithMinimumConfig.Builder::class) + @JsonDeserialize(builder = TieredPackageWithMinimumConfig.Builder::class) @NoAutoDetect - class TieredWithMinimumConfig + class TieredPackageWithMinimumConfig private constructor( private val additionalProperties: Map, ) { @@ -22676,7 +24468,7 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): TieredWithMinimumConfig = apply { + fun validate(): TieredPackageWithMinimumConfig = apply { if (!validated) { validated = true } @@ -22694,9 +24486,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredWithMinimumConfig: TieredWithMinimumConfig) = apply { - additionalProperties(tieredWithMinimumConfig.additionalProperties) - } + internal fun from(tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig) = + apply { + additionalProperties(tieredPackageWithMinimumConfig.additionalProperties) + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -22713,8 +24506,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): TieredWithMinimumConfig = - TieredWithMinimumConfig(additionalProperties.toImmutable()) + fun build(): TieredPackageWithMinimumConfig = + TieredPackageWithMinimumConfig(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -22722,7 +24515,7 @@ private constructor( return true } - return /* spotless:off */ other is TieredWithMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredPackageWithMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 @@ -22735,7 +24528,7 @@ private constructor( } override fun toString() = - "TieredWithMinimumConfig{additionalProperties=$additionalProperties}" + "TieredPackageWithMinimumConfig{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -22743,25 +24536,25 @@ private constructor( return true } - return /* spotless:off */ other is TieredWithMinimumPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.tieredWithMinimumConfig == other.tieredWithMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredPackageWithMinimumPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredWithMinimumConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredPackageWithMinimumConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "TieredWithMinimumPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredWithMinimumConfig=$tieredWithMinimumConfig, additionalProperties=$additionalProperties}" + "TieredPackageWithMinimumPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = TieredPackageWithMinimumPrice.Builder::class) + @JsonDeserialize(builder = PackageWithAllocationPrice.Builder::class) @NoAutoDetect - class TieredPackageWithMinimumPrice + class PackageWithAllocationPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -22785,7 +24578,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val tieredPackageWithMinimumConfig: JsonField, + private val packageWithAllocationConfig: JsonField, private val additionalProperties: Map, ) { @@ -22852,8 +24645,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun tieredPackageWithMinimumConfig(): TieredPackageWithMinimumConfig = - tieredPackageWithMinimumConfig.getRequired("tiered_package_with_minimum_config") + fun packageWithAllocationConfig(): PackageWithAllocationConfig = + packageWithAllocationConfig.getRequired("package_with_allocation_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -22912,15 +24705,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("tiered_package_with_minimum_config") + @JsonProperty("package_with_allocation_config") @ExcludeMissing - fun _tieredPackageWithMinimumConfig() = tieredPackageWithMinimumConfig + fun _packageWithAllocationConfig() = packageWithAllocationConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): TieredPackageWithMinimumPrice = apply { + fun validate(): PackageWithAllocationPrice = apply { if (!validated) { metadata().validate() id() @@ -22944,7 +24737,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - tieredPackageWithMinimumConfig().validate() + packageWithAllocationConfig().validate() validated = true } } @@ -22982,41 +24775,40 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var tieredPackageWithMinimumConfig: JsonField = + private var packageWithAllocationConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredPackageWithMinimumPrice: TieredPackageWithMinimumPrice) = - apply { - this.metadata = tieredPackageWithMinimumPrice.metadata - this.id = tieredPackageWithMinimumPrice.id - this.name = tieredPackageWithMinimumPrice.name - this.externalPriceId = tieredPackageWithMinimumPrice.externalPriceId - this.priceType = tieredPackageWithMinimumPrice.priceType - this.modelType = tieredPackageWithMinimumPrice.modelType - this.createdAt = tieredPackageWithMinimumPrice.createdAt - this.cadence = tieredPackageWithMinimumPrice.cadence - this.billingCycleConfiguration = - tieredPackageWithMinimumPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = - tieredPackageWithMinimumPrice.invoicingCycleConfiguration - this.billableMetric = tieredPackageWithMinimumPrice.billableMetric - this.fixedPriceQuantity = tieredPackageWithMinimumPrice.fixedPriceQuantity - this.planPhaseOrder = tieredPackageWithMinimumPrice.planPhaseOrder - this.currency = tieredPackageWithMinimumPrice.currency - this.conversionRate = tieredPackageWithMinimumPrice.conversionRate - this.item = tieredPackageWithMinimumPrice.item - this.creditAllocation = tieredPackageWithMinimumPrice.creditAllocation - this.discount = tieredPackageWithMinimumPrice.discount - this.minimum = tieredPackageWithMinimumPrice.minimum - this.minimumAmount = tieredPackageWithMinimumPrice.minimumAmount - this.maximum = tieredPackageWithMinimumPrice.maximum - this.maximumAmount = tieredPackageWithMinimumPrice.maximumAmount - this.tieredPackageWithMinimumConfig = - tieredPackageWithMinimumPrice.tieredPackageWithMinimumConfig - additionalProperties(tieredPackageWithMinimumPrice.additionalProperties) - } + internal fun from(packageWithAllocationPrice: PackageWithAllocationPrice) = apply { + this.metadata = packageWithAllocationPrice.metadata + this.id = packageWithAllocationPrice.id + this.name = packageWithAllocationPrice.name + this.externalPriceId = packageWithAllocationPrice.externalPriceId + this.priceType = packageWithAllocationPrice.priceType + this.modelType = packageWithAllocationPrice.modelType + this.createdAt = packageWithAllocationPrice.createdAt + this.cadence = packageWithAllocationPrice.cadence + this.billingCycleConfiguration = + packageWithAllocationPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = + packageWithAllocationPrice.invoicingCycleConfiguration + this.billableMetric = packageWithAllocationPrice.billableMetric + this.fixedPriceQuantity = packageWithAllocationPrice.fixedPriceQuantity + this.planPhaseOrder = packageWithAllocationPrice.planPhaseOrder + this.currency = packageWithAllocationPrice.currency + this.conversionRate = packageWithAllocationPrice.conversionRate + this.item = packageWithAllocationPrice.item + this.creditAllocation = packageWithAllocationPrice.creditAllocation + this.discount = packageWithAllocationPrice.discount + this.minimum = packageWithAllocationPrice.minimum + this.minimumAmount = packageWithAllocationPrice.minimumAmount + this.maximum = packageWithAllocationPrice.maximum + this.maximumAmount = packageWithAllocationPrice.maximumAmount + this.packageWithAllocationConfig = + packageWithAllocationPrice.packageWithAllocationConfig + additionalProperties(packageWithAllocationPrice.additionalProperties) + } /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -23190,15 +24982,15 @@ private constructor( this.maximumAmount = maximumAmount } - fun tieredPackageWithMinimumConfig( - tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig - ) = tieredPackageWithMinimumConfig(JsonField.of(tieredPackageWithMinimumConfig)) + fun packageWithAllocationConfig( + packageWithAllocationConfig: PackageWithAllocationConfig + ) = packageWithAllocationConfig(JsonField.of(packageWithAllocationConfig)) - @JsonProperty("tiered_package_with_minimum_config") + @JsonProperty("package_with_allocation_config") @ExcludeMissing - fun tieredPackageWithMinimumConfig( - tieredPackageWithMinimumConfig: JsonField - ) = apply { this.tieredPackageWithMinimumConfig = tieredPackageWithMinimumConfig } + fun packageWithAllocationConfig( + packageWithAllocationConfig: JsonField + ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -23214,8 +25006,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): TieredPackageWithMinimumPrice = - TieredPackageWithMinimumPrice( + fun build(): PackageWithAllocationPrice = + PackageWithAllocationPrice( metadata, id, name, @@ -23238,7 +25030,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - tieredPackageWithMinimumConfig, + packageWithAllocationConfig, additionalProperties.toImmutable(), ) } @@ -24337,96 +26129,38 @@ private constructor( companion object { @JvmField - val TIERED_PACKAGE_WITH_MINIMUM = - ModelType(JsonField.of("tiered_package_with_minimum")) + val PACKAGE_WITH_ALLOCATION = ModelType(JsonField.of("package_with_allocation")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - TIERED_PACKAGE_WITH_MINIMUM, + PACKAGE_WITH_ALLOCATION, } enum class Value { - TIERED_PACKAGE_WITH_MINIMUM, + PACKAGE_WITH_ALLOCATION, _UNKNOWN, } fun value(): Value = when (this) { - TIERED_PACKAGE_WITH_MINIMUM -> Value.TIERED_PACKAGE_WITH_MINIMUM + PACKAGE_WITH_ALLOCATION -> Value.PACKAGE_WITH_ALLOCATION else -> Value._UNKNOWN } fun known(): Known = when (this) { - TIERED_PACKAGE_WITH_MINIMUM -> Known.TIERED_PACKAGE_WITH_MINIMUM + PACKAGE_WITH_ALLOCATION -> Known.PACKAGE_WITH_ALLOCATION else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() } - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PriceType && this.value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val USAGE_PRICE = PriceType(JsonField.of("usage_price")) - - @JvmField val FIXED_PRICE = PriceType(JsonField.of("fixed_price")) - - @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) - } - - enum class Known { - USAGE_PRICE, - FIXED_PRICE, - } - - enum class Value { - USAGE_PRICE, - FIXED_PRICE, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - USAGE_PRICE -> Value.USAGE_PRICE - FIXED_PRICE -> Value.FIXED_PRICE - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - USAGE_PRICE -> Known.USAGE_PRICE - FIXED_PRICE -> Known.FIXED_PRICE - else -> throw OrbInvalidDataException("Unknown PriceType: $value") - } - - fun asString(): String = _value().asStringOrThrow() - } - - @JsonDeserialize(builder = TieredPackageWithMinimumConfig.Builder::class) + @JsonDeserialize(builder = PackageWithAllocationConfig.Builder::class) @NoAutoDetect - class TieredPackageWithMinimumConfig + class PackageWithAllocationConfig private constructor( private val additionalProperties: Map, ) { @@ -24437,7 +26171,7 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): TieredPackageWithMinimumConfig = apply { + fun validate(): PackageWithAllocationConfig = apply { if (!validated) { validated = true } @@ -24455,9 +26189,9 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredPackageWithMinimumConfig: TieredPackageWithMinimumConfig) = + internal fun from(packageWithAllocationConfig: PackageWithAllocationConfig) = apply { - additionalProperties(tieredPackageWithMinimumConfig.additionalProperties) + additionalProperties(packageWithAllocationConfig.additionalProperties) } fun additionalProperties(additionalProperties: Map) = apply { @@ -24475,8 +26209,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): TieredPackageWithMinimumConfig = - TieredPackageWithMinimumConfig(additionalProperties.toImmutable()) + fun build(): PackageWithAllocationConfig = + PackageWithAllocationConfig(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -24484,7 +26218,7 @@ private constructor( return true } - return /* spotless:off */ other is TieredPackageWithMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PackageWithAllocationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 @@ -24497,7 +26231,64 @@ private constructor( } override fun toString() = - "TieredPackageWithMinimumConfig{additionalProperties=$additionalProperties}" + "PackageWithAllocationConfig{additionalProperties=$additionalProperties}" + } + + class PriceType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is PriceType && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val USAGE_PRICE = PriceType(JsonField.of("usage_price")) + + @JvmField val FIXED_PRICE = PriceType(JsonField.of("fixed_price")) + + @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) + } + + enum class Known { + USAGE_PRICE, + FIXED_PRICE, + } + + enum class Value { + USAGE_PRICE, + FIXED_PRICE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + USAGE_PRICE -> Value.USAGE_PRICE + FIXED_PRICE -> Value.FIXED_PRICE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + USAGE_PRICE -> Known.USAGE_PRICE + FIXED_PRICE -> Known.FIXED_PRICE + else -> throw OrbInvalidDataException("Unknown PriceType: $value") + } + + fun asString(): String = _value().asStringOrThrow() } override fun equals(other: Any?): Boolean { @@ -24505,25 +26296,25 @@ private constructor( return true } - return /* spotless:off */ other is TieredPackageWithMinimumPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.tieredPackageWithMinimumConfig == other.tieredPackageWithMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PackageWithAllocationPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.packageWithAllocationConfig == other.packageWithAllocationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredPackageWithMinimumConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, packageWithAllocationConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "TieredPackageWithMinimumPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredPackageWithMinimumConfig=$tieredPackageWithMinimumConfig, additionalProperties=$additionalProperties}" + "PackageWithAllocationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, packageWithAllocationConfig=$packageWithAllocationConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = PackageWithAllocationPrice.Builder::class) + @JsonDeserialize(builder = UnitWithPercentPrice.Builder::class) @NoAutoDetect - class PackageWithAllocationPrice + class UnitWithPercentPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -24547,7 +26338,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val packageWithAllocationConfig: JsonField, + private val unitWithPercentConfig: JsonField, private val additionalProperties: Map, ) { @@ -24614,8 +26405,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun packageWithAllocationConfig(): PackageWithAllocationConfig = - packageWithAllocationConfig.getRequired("package_with_allocation_config") + fun unitWithPercentConfig(): UnitWithPercentConfig = + unitWithPercentConfig.getRequired("unit_with_percent_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -24674,15 +26465,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("package_with_allocation_config") + @JsonProperty("unit_with_percent_config") @ExcludeMissing - fun _packageWithAllocationConfig() = packageWithAllocationConfig + fun _unitWithPercentConfig() = unitWithPercentConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): PackageWithAllocationPrice = apply { + fun validate(): UnitWithPercentPrice = apply { if (!validated) { metadata().validate() id() @@ -24706,7 +26497,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - packageWithAllocationConfig().validate() + unitWithPercentConfig().validate() validated = true } } @@ -24744,39 +26535,35 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var packageWithAllocationConfig: JsonField = - JsonMissing.of() + private var unitWithPercentConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(packageWithAllocationPrice: PackageWithAllocationPrice) = apply { - this.metadata = packageWithAllocationPrice.metadata - this.id = packageWithAllocationPrice.id - this.name = packageWithAllocationPrice.name - this.externalPriceId = packageWithAllocationPrice.externalPriceId - this.priceType = packageWithAllocationPrice.priceType - this.modelType = packageWithAllocationPrice.modelType - this.createdAt = packageWithAllocationPrice.createdAt - this.cadence = packageWithAllocationPrice.cadence - this.billingCycleConfiguration = - packageWithAllocationPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = - packageWithAllocationPrice.invoicingCycleConfiguration - this.billableMetric = packageWithAllocationPrice.billableMetric - this.fixedPriceQuantity = packageWithAllocationPrice.fixedPriceQuantity - this.planPhaseOrder = packageWithAllocationPrice.planPhaseOrder - this.currency = packageWithAllocationPrice.currency - this.conversionRate = packageWithAllocationPrice.conversionRate - this.item = packageWithAllocationPrice.item - this.creditAllocation = packageWithAllocationPrice.creditAllocation - this.discount = packageWithAllocationPrice.discount - this.minimum = packageWithAllocationPrice.minimum - this.minimumAmount = packageWithAllocationPrice.minimumAmount - this.maximum = packageWithAllocationPrice.maximum - this.maximumAmount = packageWithAllocationPrice.maximumAmount - this.packageWithAllocationConfig = - packageWithAllocationPrice.packageWithAllocationConfig - additionalProperties(packageWithAllocationPrice.additionalProperties) + internal fun from(unitWithPercentPrice: UnitWithPercentPrice) = apply { + this.metadata = unitWithPercentPrice.metadata + this.id = unitWithPercentPrice.id + this.name = unitWithPercentPrice.name + this.externalPriceId = unitWithPercentPrice.externalPriceId + this.priceType = unitWithPercentPrice.priceType + this.modelType = unitWithPercentPrice.modelType + this.createdAt = unitWithPercentPrice.createdAt + this.cadence = unitWithPercentPrice.cadence + this.billingCycleConfiguration = unitWithPercentPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = unitWithPercentPrice.invoicingCycleConfiguration + this.billableMetric = unitWithPercentPrice.billableMetric + this.fixedPriceQuantity = unitWithPercentPrice.fixedPriceQuantity + this.planPhaseOrder = unitWithPercentPrice.planPhaseOrder + this.currency = unitWithPercentPrice.currency + this.conversionRate = unitWithPercentPrice.conversionRate + this.item = unitWithPercentPrice.item + this.creditAllocation = unitWithPercentPrice.creditAllocation + this.discount = unitWithPercentPrice.discount + this.minimum = unitWithPercentPrice.minimum + this.minimumAmount = unitWithPercentPrice.minimumAmount + this.maximum = unitWithPercentPrice.maximum + this.maximumAmount = unitWithPercentPrice.maximumAmount + this.unitWithPercentConfig = unitWithPercentPrice.unitWithPercentConfig + additionalProperties(unitWithPercentPrice.additionalProperties) } /** @@ -24951,15 +26738,15 @@ private constructor( this.maximumAmount = maximumAmount } - fun packageWithAllocationConfig( - packageWithAllocationConfig: PackageWithAllocationConfig - ) = packageWithAllocationConfig(JsonField.of(packageWithAllocationConfig)) + fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = + unitWithPercentConfig(JsonField.of(unitWithPercentConfig)) - @JsonProperty("package_with_allocation_config") + @JsonProperty("unit_with_percent_config") @ExcludeMissing - fun packageWithAllocationConfig( - packageWithAllocationConfig: JsonField - ) = apply { this.packageWithAllocationConfig = packageWithAllocationConfig } + fun unitWithPercentConfig(unitWithPercentConfig: JsonField) = + apply { + this.unitWithPercentConfig = unitWithPercentConfig + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -24975,8 +26762,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): PackageWithAllocationPrice = - PackageWithAllocationPrice( + fun build(): UnitWithPercentPrice = + UnitWithPercentPrice( metadata, id, name, @@ -24999,7 +26786,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - packageWithAllocationConfig, + unitWithPercentConfig, additionalProperties.toImmutable(), ) } @@ -26097,39 +27884,95 @@ private constructor( companion object { - @JvmField - val PACKAGE_WITH_ALLOCATION = ModelType(JsonField.of("package_with_allocation")) + @JvmField val UNIT_WITH_PERCENT = ModelType(JsonField.of("unit_with_percent")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - PACKAGE_WITH_ALLOCATION, + UNIT_WITH_PERCENT, } enum class Value { - PACKAGE_WITH_ALLOCATION, + UNIT_WITH_PERCENT, _UNKNOWN, } fun value(): Value = when (this) { - PACKAGE_WITH_ALLOCATION -> Value.PACKAGE_WITH_ALLOCATION + UNIT_WITH_PERCENT -> Value.UNIT_WITH_PERCENT else -> Value._UNKNOWN } fun known(): Known = when (this) { - PACKAGE_WITH_ALLOCATION -> Known.PACKAGE_WITH_ALLOCATION + UNIT_WITH_PERCENT -> Known.UNIT_WITH_PERCENT else -> throw OrbInvalidDataException("Unknown ModelType: $value") } fun asString(): String = _value().asStringOrThrow() } - @JsonDeserialize(builder = PackageWithAllocationConfig.Builder::class) + class PriceType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is PriceType && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val USAGE_PRICE = PriceType(JsonField.of("usage_price")) + + @JvmField val FIXED_PRICE = PriceType(JsonField.of("fixed_price")) + + @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) + } + + enum class Known { + USAGE_PRICE, + FIXED_PRICE, + } + + enum class Value { + USAGE_PRICE, + FIXED_PRICE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + USAGE_PRICE -> Value.USAGE_PRICE + FIXED_PRICE -> Value.FIXED_PRICE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + USAGE_PRICE -> Known.USAGE_PRICE + FIXED_PRICE -> Known.FIXED_PRICE + else -> throw OrbInvalidDataException("Unknown PriceType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = UnitWithPercentConfig.Builder::class) @NoAutoDetect - class PackageWithAllocationConfig + class UnitWithPercentConfig private constructor( private val additionalProperties: Map, ) { @@ -26140,7 +27983,7 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): PackageWithAllocationConfig = apply { + fun validate(): UnitWithPercentConfig = apply { if (!validated) { validated = true } @@ -26158,10 +28001,9 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(packageWithAllocationConfig: PackageWithAllocationConfig) = - apply { - additionalProperties(packageWithAllocationConfig.additionalProperties) - } + internal fun from(unitWithPercentConfig: UnitWithPercentConfig) = apply { + additionalProperties(unitWithPercentConfig.additionalProperties) + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26178,8 +28020,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): PackageWithAllocationConfig = - PackageWithAllocationConfig(additionalProperties.toImmutable()) + fun build(): UnitWithPercentConfig = + UnitWithPercentConfig(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -26187,7 +28029,7 @@ private constructor( return true } - return /* spotless:off */ other is PackageWithAllocationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitWithPercentConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 @@ -26200,64 +28042,7 @@ private constructor( } override fun toString() = - "PackageWithAllocationConfig{additionalProperties=$additionalProperties}" - } - - class PriceType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is PriceType && this.value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - - companion object { - - @JvmField val USAGE_PRICE = PriceType(JsonField.of("usage_price")) - - @JvmField val FIXED_PRICE = PriceType(JsonField.of("fixed_price")) - - @JvmStatic fun of(value: String) = PriceType(JsonField.of(value)) - } - - enum class Known { - USAGE_PRICE, - FIXED_PRICE, - } - - enum class Value { - USAGE_PRICE, - FIXED_PRICE, - _UNKNOWN, - } - - fun value(): Value = - when (this) { - USAGE_PRICE -> Value.USAGE_PRICE - FIXED_PRICE -> Value.FIXED_PRICE - else -> Value._UNKNOWN - } - - fun known(): Known = - when (this) { - USAGE_PRICE -> Known.USAGE_PRICE - FIXED_PRICE -> Known.FIXED_PRICE - else -> throw OrbInvalidDataException("Unknown PriceType: $value") - } - - fun asString(): String = _value().asStringOrThrow() + "UnitWithPercentConfig{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -26265,25 +28050,25 @@ private constructor( return true } - return /* spotless:off */ other is PackageWithAllocationPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.packageWithAllocationConfig == other.packageWithAllocationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitWithPercentPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.unitWithPercentConfig == other.unitWithPercentConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, packageWithAllocationConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, unitWithPercentConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "PackageWithAllocationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, packageWithAllocationConfig=$packageWithAllocationConfig, additionalProperties=$additionalProperties}" + "UnitWithPercentPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, unitWithPercentConfig=$unitWithPercentConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = UnitWithPercentPrice.Builder::class) + @JsonDeserialize(builder = MatrixWithAllocationPrice.Builder::class) @NoAutoDetect - class UnitWithPercentPrice + class MatrixWithAllocationPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -26307,7 +28092,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val unitWithPercentConfig: JsonField, + private val matrixWithAllocationConfig: JsonField, private val additionalProperties: Map, ) { @@ -26374,8 +28159,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun unitWithPercentConfig(): UnitWithPercentConfig = - unitWithPercentConfig.getRequired("unit_with_percent_config") + fun matrixWithAllocationConfig(): MatrixWithAllocationConfig = + matrixWithAllocationConfig.getRequired("matrix_with_allocation_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -26434,15 +28219,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("unit_with_percent_config") + @JsonProperty("matrix_with_allocation_config") @ExcludeMissing - fun _unitWithPercentConfig() = unitWithPercentConfig + fun _matrixWithAllocationConfig() = matrixWithAllocationConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): UnitWithPercentPrice = apply { + fun validate(): MatrixWithAllocationPrice = apply { if (!validated) { metadata().validate() id() @@ -26466,7 +28251,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - unitWithPercentConfig().validate() + matrixWithAllocationConfig().validate() validated = true } } @@ -26504,35 +28289,38 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var unitWithPercentConfig: JsonField = JsonMissing.of() + private var matrixWithAllocationConfig: JsonField = + JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(unitWithPercentPrice: UnitWithPercentPrice) = apply { - this.metadata = unitWithPercentPrice.metadata - this.id = unitWithPercentPrice.id - this.name = unitWithPercentPrice.name - this.externalPriceId = unitWithPercentPrice.externalPriceId - this.priceType = unitWithPercentPrice.priceType - this.modelType = unitWithPercentPrice.modelType - this.createdAt = unitWithPercentPrice.createdAt - this.cadence = unitWithPercentPrice.cadence - this.billingCycleConfiguration = unitWithPercentPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = unitWithPercentPrice.invoicingCycleConfiguration - this.billableMetric = unitWithPercentPrice.billableMetric - this.fixedPriceQuantity = unitWithPercentPrice.fixedPriceQuantity - this.planPhaseOrder = unitWithPercentPrice.planPhaseOrder - this.currency = unitWithPercentPrice.currency - this.conversionRate = unitWithPercentPrice.conversionRate - this.item = unitWithPercentPrice.item - this.creditAllocation = unitWithPercentPrice.creditAllocation - this.discount = unitWithPercentPrice.discount - this.minimum = unitWithPercentPrice.minimum - this.minimumAmount = unitWithPercentPrice.minimumAmount - this.maximum = unitWithPercentPrice.maximum - this.maximumAmount = unitWithPercentPrice.maximumAmount - this.unitWithPercentConfig = unitWithPercentPrice.unitWithPercentConfig - additionalProperties(unitWithPercentPrice.additionalProperties) + internal fun from(matrixWithAllocationPrice: MatrixWithAllocationPrice) = apply { + this.metadata = matrixWithAllocationPrice.metadata + this.id = matrixWithAllocationPrice.id + this.name = matrixWithAllocationPrice.name + this.externalPriceId = matrixWithAllocationPrice.externalPriceId + this.priceType = matrixWithAllocationPrice.priceType + this.modelType = matrixWithAllocationPrice.modelType + this.createdAt = matrixWithAllocationPrice.createdAt + this.cadence = matrixWithAllocationPrice.cadence + this.billingCycleConfiguration = matrixWithAllocationPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = + matrixWithAllocationPrice.invoicingCycleConfiguration + this.billableMetric = matrixWithAllocationPrice.billableMetric + this.fixedPriceQuantity = matrixWithAllocationPrice.fixedPriceQuantity + this.planPhaseOrder = matrixWithAllocationPrice.planPhaseOrder + this.currency = matrixWithAllocationPrice.currency + this.conversionRate = matrixWithAllocationPrice.conversionRate + this.item = matrixWithAllocationPrice.item + this.creditAllocation = matrixWithAllocationPrice.creditAllocation + this.discount = matrixWithAllocationPrice.discount + this.minimum = matrixWithAllocationPrice.minimum + this.minimumAmount = matrixWithAllocationPrice.minimumAmount + this.maximum = matrixWithAllocationPrice.maximum + this.maximumAmount = matrixWithAllocationPrice.maximumAmount + this.matrixWithAllocationConfig = + matrixWithAllocationPrice.matrixWithAllocationConfig + additionalProperties(matrixWithAllocationPrice.additionalProperties) } /** @@ -26707,15 +28495,14 @@ private constructor( this.maximumAmount = maximumAmount } - fun unitWithPercentConfig(unitWithPercentConfig: UnitWithPercentConfig) = - unitWithPercentConfig(JsonField.of(unitWithPercentConfig)) + fun matrixWithAllocationConfig(matrixWithAllocationConfig: MatrixWithAllocationConfig) = + matrixWithAllocationConfig(JsonField.of(matrixWithAllocationConfig)) - @JsonProperty("unit_with_percent_config") + @JsonProperty("matrix_with_allocation_config") @ExcludeMissing - fun unitWithPercentConfig(unitWithPercentConfig: JsonField) = - apply { - this.unitWithPercentConfig = unitWithPercentConfig - } + fun matrixWithAllocationConfig( + matrixWithAllocationConfig: JsonField + ) = apply { this.matrixWithAllocationConfig = matrixWithAllocationConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26731,8 +28518,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): UnitWithPercentPrice = - UnitWithPercentPrice( + fun build(): MatrixWithAllocationPrice = + MatrixWithAllocationPrice( metadata, id, name, @@ -26755,7 +28542,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - unitWithPercentConfig, + matrixWithAllocationConfig, additionalProperties.toImmutable(), ) } @@ -27481,6 +29268,314 @@ private constructor( "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" } + @JsonDeserialize(builder = MatrixWithAllocationConfig.Builder::class) + @NoAutoDetect + class MatrixWithAllocationConfig + private constructor( + private val dimensions: JsonField>, + private val defaultUnitAmount: JsonField, + private val matrixValues: JsonField>, + private val allocation: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(): List = dimensions.getRequired("dimensions") + + /** Default per unit rate for any usage not bucketed into a specified matrix_value */ + fun defaultUnitAmount(): String = defaultUnitAmount.getRequired("default_unit_amount") + + /** Matrix values for specified matrix grouping keys */ + fun matrixValues(): List = matrixValues.getRequired("matrix_values") + + /** Allocation to be used to calculate the price */ + fun allocation(): Double = allocation.getRequired("allocation") + + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") @ExcludeMissing fun _dimensions() = dimensions + + /** Default per unit rate for any usage not bucketed into a specified matrix_value */ + @JsonProperty("default_unit_amount") + @ExcludeMissing + fun _defaultUnitAmount() = defaultUnitAmount + + /** Matrix values for specified matrix grouping keys */ + @JsonProperty("matrix_values") @ExcludeMissing fun _matrixValues() = matrixValues + + /** Allocation to be used to calculate the price */ + @JsonProperty("allocation") @ExcludeMissing fun _allocation() = allocation + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): MatrixWithAllocationConfig = apply { + if (!validated) { + dimensions() + defaultUnitAmount() + matrixValues().forEach { it.validate() } + allocation() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var dimensions: JsonField> = JsonMissing.of() + private var defaultUnitAmount: JsonField = JsonMissing.of() + private var matrixValues: JsonField> = JsonMissing.of() + private var allocation: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(matrixWithAllocationConfig: MatrixWithAllocationConfig) = apply { + this.dimensions = matrixWithAllocationConfig.dimensions + this.defaultUnitAmount = matrixWithAllocationConfig.defaultUnitAmount + this.matrixValues = matrixWithAllocationConfig.matrixValues + this.allocation = matrixWithAllocationConfig.allocation + additionalProperties(matrixWithAllocationConfig.additionalProperties) + } + + /** One or two event property values to evaluate matrix groups by */ + fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) + + /** One or two event property values to evaluate matrix groups by */ + @JsonProperty("dimensions") + @ExcludeMissing + fun dimensions(dimensions: JsonField>) = apply { + this.dimensions = dimensions + } + + /** + * Default per unit rate for any usage not bucketed into a specified matrix_value + */ + fun defaultUnitAmount(defaultUnitAmount: String) = + defaultUnitAmount(JsonField.of(defaultUnitAmount)) + + /** + * Default per unit rate for any usage not bucketed into a specified matrix_value + */ + @JsonProperty("default_unit_amount") + @ExcludeMissing + fun defaultUnitAmount(defaultUnitAmount: JsonField) = apply { + this.defaultUnitAmount = defaultUnitAmount + } + + /** Matrix values for specified matrix grouping keys */ + fun matrixValues(matrixValues: List) = + matrixValues(JsonField.of(matrixValues)) + + /** Matrix values for specified matrix grouping keys */ + @JsonProperty("matrix_values") + @ExcludeMissing + fun matrixValues(matrixValues: JsonField>) = apply { + this.matrixValues = matrixValues + } + + /** Allocation to be used to calculate the price */ + fun allocation(allocation: Double) = allocation(JsonField.of(allocation)) + + /** Allocation to be used to calculate the price */ + @JsonProperty("allocation") + @ExcludeMissing + fun allocation(allocation: JsonField) = apply { + this.allocation = allocation + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): MatrixWithAllocationConfig = + MatrixWithAllocationConfig( + dimensions.map { it.toImmutable() }, + defaultUnitAmount, + matrixValues.map { it.toImmutable() }, + allocation, + additionalProperties.toImmutable(), + ) + } + + @JsonDeserialize(builder = MatrixValue.Builder::class) + @NoAutoDetect + class MatrixValue + private constructor( + private val unitAmount: JsonField, + private val dimensionValues: JsonField>, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** Unit price for the specified dimension_values */ + fun unitAmount(): String = unitAmount.getRequired("unit_amount") + + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and an + * instance tier. + */ + fun dimensionValues(): List = + dimensionValues.getRequired("dimension_values") + + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount + + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and an + * instance tier. + */ + @JsonProperty("dimension_values") + @ExcludeMissing + fun _dimensionValues() = dimensionValues + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): MatrixValue = apply { + if (!validated) { + unitAmount() + dimensionValues() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var unitAmount: JsonField = JsonMissing.of() + private var dimensionValues: JsonField> = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(matrixValue: MatrixValue) = apply { + this.unitAmount = matrixValue.unitAmount + this.dimensionValues = matrixValue.dimensionValues + additionalProperties(matrixValue.additionalProperties) + } + + /** Unit price for the specified dimension_values */ + fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) + + /** Unit price for the specified dimension_values */ + @JsonProperty("unit_amount") + @ExcludeMissing + fun unitAmount(unitAmount: JsonField) = apply { + this.unitAmount = unitAmount + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and + * an instance tier. + */ + fun dimensionValues(dimensionValues: List) = + dimensionValues(JsonField.of(dimensionValues)) + + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and + * an instance tier. + */ + @JsonProperty("dimension_values") + @ExcludeMissing + fun dimensionValues(dimensionValues: JsonField>) = apply { + this.dimensionValues = dimensionValues + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): MatrixValue = + MatrixValue( + unitAmount, + dimensionValues.map { it.toImmutable() }, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is MatrixValue && this.unitAmount == other.unitAmount && this.dimensionValues == other.dimensionValues && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(unitAmount, dimensionValues, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is MatrixWithAllocationConfig && this.dimensions == other.dimensions && this.defaultUnitAmount == other.defaultUnitAmount && this.matrixValues == other.matrixValues && this.allocation == other.allocation && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(dimensions, defaultUnitAmount, matrixValues, allocation, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "MatrixWithAllocationConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, allocation=$allocation, additionalProperties=$additionalProperties}" + } + @JsonDeserialize(builder = Maximum.Builder::class) @NoAutoDetect class Maximum @@ -27853,29 +29948,30 @@ private constructor( companion object { - @JvmField val UNIT_WITH_PERCENT = ModelType(JsonField.of("unit_with_percent")) + @JvmField + val MATRIX_WITH_ALLOCATION = ModelType(JsonField.of("matrix_with_allocation")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - UNIT_WITH_PERCENT, + MATRIX_WITH_ALLOCATION, } enum class Value { - UNIT_WITH_PERCENT, + MATRIX_WITH_ALLOCATION, _UNKNOWN, } fun value(): Value = when (this) { - UNIT_WITH_PERCENT -> Value.UNIT_WITH_PERCENT + MATRIX_WITH_ALLOCATION -> Value.MATRIX_WITH_ALLOCATION else -> Value._UNKNOWN } fun known(): Known = when (this) { - UNIT_WITH_PERCENT -> Known.UNIT_WITH_PERCENT + MATRIX_WITH_ALLOCATION -> Known.MATRIX_WITH_ALLOCATION else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -27939,105 +30035,30 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } - @JsonDeserialize(builder = UnitWithPercentConfig.Builder::class) - @NoAutoDetect - class UnitWithPercentConfig - private constructor( - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): UnitWithPercentConfig = apply { - if (!validated) { - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(unitWithPercentConfig: UnitWithPercentConfig) = apply { - additionalProperties(unitWithPercentConfig.additionalProperties) - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): UnitWithPercentConfig = - UnitWithPercentConfig(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is UnitWithPercentConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "UnitWithPercentConfig{additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is UnitWithPercentPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.unitWithPercentConfig == other.unitWithPercentConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithAllocationPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.matrixWithAllocationConfig == other.matrixWithAllocationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, unitWithPercentConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, matrixWithAllocationConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "UnitWithPercentPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, unitWithPercentConfig=$unitWithPercentConfig, additionalProperties=$additionalProperties}" + "MatrixWithAllocationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, matrixWithAllocationConfig=$matrixWithAllocationConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = MatrixWithAllocationPrice.Builder::class) + @JsonDeserialize(builder = TieredWithProrationPrice.Builder::class) @NoAutoDetect - class MatrixWithAllocationPrice + class TieredWithProrationPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -28061,7 +30082,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val matrixWithAllocationConfig: JsonField, + private val tieredWithProrationConfig: JsonField, private val additionalProperties: Map, ) { @@ -28128,8 +30149,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun matrixWithAllocationConfig(): MatrixWithAllocationConfig = - matrixWithAllocationConfig.getRequired("matrix_with_allocation_config") + fun tieredWithProrationConfig(): TieredWithProrationConfig = + tieredWithProrationConfig.getRequired("tiered_with_proration_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -28188,15 +30209,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("matrix_with_allocation_config") + @JsonProperty("tiered_with_proration_config") @ExcludeMissing - fun _matrixWithAllocationConfig() = matrixWithAllocationConfig + fun _tieredWithProrationConfig() = tieredWithProrationConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): MatrixWithAllocationPrice = apply { + fun validate(): TieredWithProrationPrice = apply { if (!validated) { metadata().validate() id() @@ -28220,7 +30241,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - matrixWithAllocationConfig().validate() + tieredWithProrationConfig().validate() validated = true } } @@ -28258,38 +30279,37 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var matrixWithAllocationConfig: JsonField = + private var tieredWithProrationConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(matrixWithAllocationPrice: MatrixWithAllocationPrice) = apply { - this.metadata = matrixWithAllocationPrice.metadata - this.id = matrixWithAllocationPrice.id - this.name = matrixWithAllocationPrice.name - this.externalPriceId = matrixWithAllocationPrice.externalPriceId - this.priceType = matrixWithAllocationPrice.priceType - this.modelType = matrixWithAllocationPrice.modelType - this.createdAt = matrixWithAllocationPrice.createdAt - this.cadence = matrixWithAllocationPrice.cadence - this.billingCycleConfiguration = matrixWithAllocationPrice.billingCycleConfiguration + internal fun from(tieredWithProrationPrice: TieredWithProrationPrice) = apply { + this.metadata = tieredWithProrationPrice.metadata + this.id = tieredWithProrationPrice.id + this.name = tieredWithProrationPrice.name + this.externalPriceId = tieredWithProrationPrice.externalPriceId + this.priceType = tieredWithProrationPrice.priceType + this.modelType = tieredWithProrationPrice.modelType + this.createdAt = tieredWithProrationPrice.createdAt + this.cadence = tieredWithProrationPrice.cadence + this.billingCycleConfiguration = tieredWithProrationPrice.billingCycleConfiguration this.invoicingCycleConfiguration = - matrixWithAllocationPrice.invoicingCycleConfiguration - this.billableMetric = matrixWithAllocationPrice.billableMetric - this.fixedPriceQuantity = matrixWithAllocationPrice.fixedPriceQuantity - this.planPhaseOrder = matrixWithAllocationPrice.planPhaseOrder - this.currency = matrixWithAllocationPrice.currency - this.conversionRate = matrixWithAllocationPrice.conversionRate - this.item = matrixWithAllocationPrice.item - this.creditAllocation = matrixWithAllocationPrice.creditAllocation - this.discount = matrixWithAllocationPrice.discount - this.minimum = matrixWithAllocationPrice.minimum - this.minimumAmount = matrixWithAllocationPrice.minimumAmount - this.maximum = matrixWithAllocationPrice.maximum - this.maximumAmount = matrixWithAllocationPrice.maximumAmount - this.matrixWithAllocationConfig = - matrixWithAllocationPrice.matrixWithAllocationConfig - additionalProperties(matrixWithAllocationPrice.additionalProperties) + tieredWithProrationPrice.invoicingCycleConfiguration + this.billableMetric = tieredWithProrationPrice.billableMetric + this.fixedPriceQuantity = tieredWithProrationPrice.fixedPriceQuantity + this.planPhaseOrder = tieredWithProrationPrice.planPhaseOrder + this.currency = tieredWithProrationPrice.currency + this.conversionRate = tieredWithProrationPrice.conversionRate + this.item = tieredWithProrationPrice.item + this.creditAllocation = tieredWithProrationPrice.creditAllocation + this.discount = tieredWithProrationPrice.discount + this.minimum = tieredWithProrationPrice.minimum + this.minimumAmount = tieredWithProrationPrice.minimumAmount + this.maximum = tieredWithProrationPrice.maximum + this.maximumAmount = tieredWithProrationPrice.maximumAmount + this.tieredWithProrationConfig = tieredWithProrationPrice.tieredWithProrationConfig + additionalProperties(tieredWithProrationPrice.additionalProperties) } /** @@ -28464,14 +30484,14 @@ private constructor( this.maximumAmount = maximumAmount } - fun matrixWithAllocationConfig(matrixWithAllocationConfig: MatrixWithAllocationConfig) = - matrixWithAllocationConfig(JsonField.of(matrixWithAllocationConfig)) + fun tieredWithProrationConfig(tieredWithProrationConfig: TieredWithProrationConfig) = + tieredWithProrationConfig(JsonField.of(tieredWithProrationConfig)) - @JsonProperty("matrix_with_allocation_config") + @JsonProperty("tiered_with_proration_config") @ExcludeMissing - fun matrixWithAllocationConfig( - matrixWithAllocationConfig: JsonField - ) = apply { this.matrixWithAllocationConfig = matrixWithAllocationConfig } + fun tieredWithProrationConfig( + tieredWithProrationConfig: JsonField + ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -28487,8 +30507,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): MatrixWithAllocationPrice = - MatrixWithAllocationPrice( + fun build(): TieredWithProrationPrice = + TieredWithProrationPrice( metadata, id, name, @@ -28511,7 +30531,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - matrixWithAllocationConfig, + tieredWithProrationConfig, additionalProperties.toImmutable(), ) } @@ -29237,314 +31257,6 @@ private constructor( "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = MatrixWithAllocationConfig.Builder::class) - @NoAutoDetect - class MatrixWithAllocationConfig - private constructor( - private val dimensions: JsonField>, - private val defaultUnitAmount: JsonField, - private val matrixValues: JsonField>, - private val allocation: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(): List = dimensions.getRequired("dimensions") - - /** Default per unit rate for any usage not bucketed into a specified matrix_value */ - fun defaultUnitAmount(): String = defaultUnitAmount.getRequired("default_unit_amount") - - /** Matrix values for specified matrix grouping keys */ - fun matrixValues(): List = matrixValues.getRequired("matrix_values") - - /** Allocation to be used to calculate the price */ - fun allocation(): Double = allocation.getRequired("allocation") - - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") @ExcludeMissing fun _dimensions() = dimensions - - /** Default per unit rate for any usage not bucketed into a specified matrix_value */ - @JsonProperty("default_unit_amount") - @ExcludeMissing - fun _defaultUnitAmount() = defaultUnitAmount - - /** Matrix values for specified matrix grouping keys */ - @JsonProperty("matrix_values") @ExcludeMissing fun _matrixValues() = matrixValues - - /** Allocation to be used to calculate the price */ - @JsonProperty("allocation") @ExcludeMissing fun _allocation() = allocation - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): MatrixWithAllocationConfig = apply { - if (!validated) { - dimensions() - defaultUnitAmount() - matrixValues().forEach { it.validate() } - allocation() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var dimensions: JsonField> = JsonMissing.of() - private var defaultUnitAmount: JsonField = JsonMissing.of() - private var matrixValues: JsonField> = JsonMissing.of() - private var allocation: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(matrixWithAllocationConfig: MatrixWithAllocationConfig) = apply { - this.dimensions = matrixWithAllocationConfig.dimensions - this.defaultUnitAmount = matrixWithAllocationConfig.defaultUnitAmount - this.matrixValues = matrixWithAllocationConfig.matrixValues - this.allocation = matrixWithAllocationConfig.allocation - additionalProperties(matrixWithAllocationConfig.additionalProperties) - } - - /** One or two event property values to evaluate matrix groups by */ - fun dimensions(dimensions: List) = dimensions(JsonField.of(dimensions)) - - /** One or two event property values to evaluate matrix groups by */ - @JsonProperty("dimensions") - @ExcludeMissing - fun dimensions(dimensions: JsonField>) = apply { - this.dimensions = dimensions - } - - /** - * Default per unit rate for any usage not bucketed into a specified matrix_value - */ - fun defaultUnitAmount(defaultUnitAmount: String) = - defaultUnitAmount(JsonField.of(defaultUnitAmount)) - - /** - * Default per unit rate for any usage not bucketed into a specified matrix_value - */ - @JsonProperty("default_unit_amount") - @ExcludeMissing - fun defaultUnitAmount(defaultUnitAmount: JsonField) = apply { - this.defaultUnitAmount = defaultUnitAmount - } - - /** Matrix values for specified matrix grouping keys */ - fun matrixValues(matrixValues: List) = - matrixValues(JsonField.of(matrixValues)) - - /** Matrix values for specified matrix grouping keys */ - @JsonProperty("matrix_values") - @ExcludeMissing - fun matrixValues(matrixValues: JsonField>) = apply { - this.matrixValues = matrixValues - } - - /** Allocation to be used to calculate the price */ - fun allocation(allocation: Double) = allocation(JsonField.of(allocation)) - - /** Allocation to be used to calculate the price */ - @JsonProperty("allocation") - @ExcludeMissing - fun allocation(allocation: JsonField) = apply { - this.allocation = allocation - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): MatrixWithAllocationConfig = - MatrixWithAllocationConfig( - dimensions.map { it.toImmutable() }, - defaultUnitAmount, - matrixValues.map { it.toImmutable() }, - allocation, - additionalProperties.toImmutable(), - ) - } - - @JsonDeserialize(builder = MatrixValue.Builder::class) - @NoAutoDetect - class MatrixValue - private constructor( - private val unitAmount: JsonField, - private val dimensionValues: JsonField>, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - /** Unit price for the specified dimension_values */ - fun unitAmount(): String = unitAmount.getRequired("unit_amount") - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and an - * instance tier. - */ - fun dimensionValues(): List = - dimensionValues.getRequired("dimension_values") - - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount() = unitAmount - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and an - * instance tier. - */ - @JsonProperty("dimension_values") - @ExcludeMissing - fun _dimensionValues() = dimensionValues - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): MatrixValue = apply { - if (!validated) { - unitAmount() - dimensionValues() - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var unitAmount: JsonField = JsonMissing.of() - private var dimensionValues: JsonField> = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(matrixValue: MatrixValue) = apply { - this.unitAmount = matrixValue.unitAmount - this.dimensionValues = matrixValue.dimensionValues - additionalProperties(matrixValue.additionalProperties) - } - - /** Unit price for the specified dimension_values */ - fun unitAmount(unitAmount: String) = unitAmount(JsonField.of(unitAmount)) - - /** Unit price for the specified dimension_values */ - @JsonProperty("unit_amount") - @ExcludeMissing - fun unitAmount(unitAmount: JsonField) = apply { - this.unitAmount = unitAmount - } - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and - * an instance tier. - */ - fun dimensionValues(dimensionValues: List) = - dimensionValues(JsonField.of(dimensionValues)) - - /** - * One or two matrix keys to filter usage to this Matrix value by. For example, - * ["region", "tier"] could be used to filter cloud usage by a cloud region and - * an instance tier. - */ - @JsonProperty("dimension_values") - @ExcludeMissing - fun dimensionValues(dimensionValues: JsonField>) = apply { - this.dimensionValues = dimensionValues - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): MatrixValue = - MatrixValue( - unitAmount, - dimensionValues.map { it.toImmutable() }, - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is MatrixValue && this.unitAmount == other.unitAmount && this.dimensionValues == other.dimensionValues && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(unitAmount, dimensionValues, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "MatrixValue{unitAmount=$unitAmount, dimensionValues=$dimensionValues, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is MatrixWithAllocationConfig && this.dimensions == other.dimensions && this.defaultUnitAmount == other.defaultUnitAmount && this.matrixValues == other.matrixValues && this.allocation == other.allocation && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(dimensions, defaultUnitAmount, matrixValues, allocation, additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "MatrixWithAllocationConfig{dimensions=$dimensions, defaultUnitAmount=$defaultUnitAmount, matrixValues=$matrixValues, allocation=$allocation, additionalProperties=$additionalProperties}" - } - @JsonDeserialize(builder = Maximum.Builder::class) @NoAutoDetect class Maximum @@ -29918,29 +31630,29 @@ private constructor( companion object { @JvmField - val MATRIX_WITH_ALLOCATION = ModelType(JsonField.of("matrix_with_allocation")) + val TIERED_WITH_PRORATION = ModelType(JsonField.of("tiered_with_proration")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - MATRIX_WITH_ALLOCATION, + TIERED_WITH_PRORATION, } enum class Value { - MATRIX_WITH_ALLOCATION, + TIERED_WITH_PRORATION, _UNKNOWN, } fun value(): Value = when (this) { - MATRIX_WITH_ALLOCATION -> Value.MATRIX_WITH_ALLOCATION + TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION else -> Value._UNKNOWN } fun known(): Known = when (this) { - MATRIX_WITH_ALLOCATION -> Known.MATRIX_WITH_ALLOCATION + TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -30004,30 +31716,105 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } + @JsonDeserialize(builder = TieredWithProrationConfig.Builder::class) + @NoAutoDetect + class TieredWithProrationConfig + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): TieredWithProrationConfig = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tieredWithProrationConfig: TieredWithProrationConfig) = apply { + additionalProperties(tieredWithProrationConfig.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): TieredWithProrationConfig = + TieredWithProrationConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TieredWithProrationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "TieredWithProrationConfig{additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is MatrixWithAllocationPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.matrixWithAllocationConfig == other.matrixWithAllocationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is TieredWithProrationPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.tieredWithProrationConfig == other.tieredWithProrationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, matrixWithAllocationConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredWithProrationConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "MatrixWithAllocationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, matrixWithAllocationConfig=$matrixWithAllocationConfig, additionalProperties=$additionalProperties}" + "TieredWithProrationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredWithProrationConfig=$tieredWithProrationConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = TieredWithProrationPrice.Builder::class) + @JsonDeserialize(builder = UnitWithProrationPrice.Builder::class) @NoAutoDetect - class TieredWithProrationPrice + class UnitWithProrationPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -30051,7 +31838,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val tieredWithProrationConfig: JsonField, + private val unitWithProrationConfig: JsonField, private val additionalProperties: Map, ) { @@ -30118,8 +31905,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun tieredWithProrationConfig(): TieredWithProrationConfig = - tieredWithProrationConfig.getRequired("tiered_with_proration_config") + fun unitWithProrationConfig(): UnitWithProrationConfig = + unitWithProrationConfig.getRequired("unit_with_proration_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -30178,15 +31965,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("tiered_with_proration_config") + @JsonProperty("unit_with_proration_config") @ExcludeMissing - fun _tieredWithProrationConfig() = tieredWithProrationConfig + fun _unitWithProrationConfig() = unitWithProrationConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): TieredWithProrationPrice = apply { + fun validate(): UnitWithProrationPrice = apply { if (!validated) { metadata().validate() id() @@ -30210,7 +31997,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - tieredWithProrationConfig().validate() + unitWithProrationConfig().validate() validated = true } } @@ -30248,37 +32035,37 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var tieredWithProrationConfig: JsonField = + private var unitWithProrationConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredWithProrationPrice: TieredWithProrationPrice) = apply { - this.metadata = tieredWithProrationPrice.metadata - this.id = tieredWithProrationPrice.id - this.name = tieredWithProrationPrice.name - this.externalPriceId = tieredWithProrationPrice.externalPriceId - this.priceType = tieredWithProrationPrice.priceType - this.modelType = tieredWithProrationPrice.modelType - this.createdAt = tieredWithProrationPrice.createdAt - this.cadence = tieredWithProrationPrice.cadence - this.billingCycleConfiguration = tieredWithProrationPrice.billingCycleConfiguration + internal fun from(unitWithProrationPrice: UnitWithProrationPrice) = apply { + this.metadata = unitWithProrationPrice.metadata + this.id = unitWithProrationPrice.id + this.name = unitWithProrationPrice.name + this.externalPriceId = unitWithProrationPrice.externalPriceId + this.priceType = unitWithProrationPrice.priceType + this.modelType = unitWithProrationPrice.modelType + this.createdAt = unitWithProrationPrice.createdAt + this.cadence = unitWithProrationPrice.cadence + this.billingCycleConfiguration = unitWithProrationPrice.billingCycleConfiguration this.invoicingCycleConfiguration = - tieredWithProrationPrice.invoicingCycleConfiguration - this.billableMetric = tieredWithProrationPrice.billableMetric - this.fixedPriceQuantity = tieredWithProrationPrice.fixedPriceQuantity - this.planPhaseOrder = tieredWithProrationPrice.planPhaseOrder - this.currency = tieredWithProrationPrice.currency - this.conversionRate = tieredWithProrationPrice.conversionRate - this.item = tieredWithProrationPrice.item - this.creditAllocation = tieredWithProrationPrice.creditAllocation - this.discount = tieredWithProrationPrice.discount - this.minimum = tieredWithProrationPrice.minimum - this.minimumAmount = tieredWithProrationPrice.minimumAmount - this.maximum = tieredWithProrationPrice.maximum - this.maximumAmount = tieredWithProrationPrice.maximumAmount - this.tieredWithProrationConfig = tieredWithProrationPrice.tieredWithProrationConfig - additionalProperties(tieredWithProrationPrice.additionalProperties) + unitWithProrationPrice.invoicingCycleConfiguration + this.billableMetric = unitWithProrationPrice.billableMetric + this.fixedPriceQuantity = unitWithProrationPrice.fixedPriceQuantity + this.planPhaseOrder = unitWithProrationPrice.planPhaseOrder + this.currency = unitWithProrationPrice.currency + this.conversionRate = unitWithProrationPrice.conversionRate + this.item = unitWithProrationPrice.item + this.creditAllocation = unitWithProrationPrice.creditAllocation + this.discount = unitWithProrationPrice.discount + this.minimum = unitWithProrationPrice.minimum + this.minimumAmount = unitWithProrationPrice.minimumAmount + this.maximum = unitWithProrationPrice.maximum + this.maximumAmount = unitWithProrationPrice.maximumAmount + this.unitWithProrationConfig = unitWithProrationPrice.unitWithProrationConfig + additionalProperties(unitWithProrationPrice.additionalProperties) } /** @@ -30453,14 +32240,14 @@ private constructor( this.maximumAmount = maximumAmount } - fun tieredWithProrationConfig(tieredWithProrationConfig: TieredWithProrationConfig) = - tieredWithProrationConfig(JsonField.of(tieredWithProrationConfig)) + fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = + unitWithProrationConfig(JsonField.of(unitWithProrationConfig)) - @JsonProperty("tiered_with_proration_config") + @JsonProperty("unit_with_proration_config") @ExcludeMissing - fun tieredWithProrationConfig( - tieredWithProrationConfig: JsonField - ) = apply { this.tieredWithProrationConfig = tieredWithProrationConfig } + fun unitWithProrationConfig( + unitWithProrationConfig: JsonField + ) = apply { this.unitWithProrationConfig = unitWithProrationConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -30476,8 +32263,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): TieredWithProrationPrice = - TieredWithProrationPrice( + fun build(): UnitWithProrationPrice = + UnitWithProrationPrice( metadata, id, name, @@ -30500,7 +32287,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - tieredWithProrationConfig, + unitWithProrationConfig, additionalProperties.toImmutable(), ) } @@ -31598,30 +33385,29 @@ private constructor( companion object { - @JvmField - val TIERED_WITH_PRORATION = ModelType(JsonField.of("tiered_with_proration")) + @JvmField val UNIT_WITH_PRORATION = ModelType(JsonField.of("unit_with_proration")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - TIERED_WITH_PRORATION, + UNIT_WITH_PRORATION, } enum class Value { - TIERED_WITH_PRORATION, + UNIT_WITH_PRORATION, _UNKNOWN, } fun value(): Value = when (this) { - TIERED_WITH_PRORATION -> Value.TIERED_WITH_PRORATION + UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION else -> Value._UNKNOWN } fun known(): Known = when (this) { - TIERED_WITH_PRORATION -> Known.TIERED_WITH_PRORATION + UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -31685,9 +33471,9 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } - @JsonDeserialize(builder = TieredWithProrationConfig.Builder::class) + @JsonDeserialize(builder = UnitWithProrationConfig.Builder::class) @NoAutoDetect - class TieredWithProrationConfig + class UnitWithProrationConfig private constructor( private val additionalProperties: Map, ) { @@ -31698,7 +33484,7 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): TieredWithProrationConfig = apply { + fun validate(): UnitWithProrationConfig = apply { if (!validated) { validated = true } @@ -31716,8 +33502,8 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tieredWithProrationConfig: TieredWithProrationConfig) = apply { - additionalProperties(tieredWithProrationConfig.additionalProperties) + internal fun from(unitWithProrationConfig: UnitWithProrationConfig) = apply { + additionalProperties(unitWithProrationConfig.additionalProperties) } fun additionalProperties(additionalProperties: Map) = apply { @@ -31735,8 +33521,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): TieredWithProrationConfig = - TieredWithProrationConfig(additionalProperties.toImmutable()) + fun build(): UnitWithProrationConfig = + UnitWithProrationConfig(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -31744,7 +33530,7 @@ private constructor( return true } - return /* spotless:off */ other is TieredWithProrationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitWithProrationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 @@ -31757,7 +33543,7 @@ private constructor( } override fun toString() = - "TieredWithProrationConfig{additionalProperties=$additionalProperties}" + "UnitWithProrationConfig{additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -31765,25 +33551,25 @@ private constructor( return true } - return /* spotless:off */ other is TieredWithProrationPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.tieredWithProrationConfig == other.tieredWithProrationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnitWithProrationPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.unitWithProrationConfig == other.unitWithProrationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, tieredWithProrationConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, unitWithProrationConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "TieredWithProrationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, tieredWithProrationConfig=$tieredWithProrationConfig, additionalProperties=$additionalProperties}" + "UnitWithProrationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, unitWithProrationConfig=$unitWithProrationConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = UnitWithProrationPrice.Builder::class) + @JsonDeserialize(builder = GroupedAllocationPrice.Builder::class) @NoAutoDetect - class UnitWithProrationPrice + class GroupedAllocationPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -31807,7 +33593,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val unitWithProrationConfig: JsonField, + private val groupedAllocationConfig: JsonField, private val additionalProperties: Map, ) { @@ -31874,8 +33660,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun unitWithProrationConfig(): UnitWithProrationConfig = - unitWithProrationConfig.getRequired("unit_with_proration_config") + fun groupedAllocationConfig(): GroupedAllocationConfig = + groupedAllocationConfig.getRequired("grouped_allocation_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -31934,15 +33720,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("unit_with_proration_config") + @JsonProperty("grouped_allocation_config") @ExcludeMissing - fun _unitWithProrationConfig() = unitWithProrationConfig + fun _groupedAllocationConfig() = groupedAllocationConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): UnitWithProrationPrice = apply { + fun validate(): GroupedAllocationPrice = apply { if (!validated) { metadata().validate() id() @@ -31966,7 +33752,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - unitWithProrationConfig().validate() + groupedAllocationConfig().validate() validated = true } } @@ -32004,37 +33790,37 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var unitWithProrationConfig: JsonField = + private var groupedAllocationConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(unitWithProrationPrice: UnitWithProrationPrice) = apply { - this.metadata = unitWithProrationPrice.metadata - this.id = unitWithProrationPrice.id - this.name = unitWithProrationPrice.name - this.externalPriceId = unitWithProrationPrice.externalPriceId - this.priceType = unitWithProrationPrice.priceType - this.modelType = unitWithProrationPrice.modelType - this.createdAt = unitWithProrationPrice.createdAt - this.cadence = unitWithProrationPrice.cadence - this.billingCycleConfiguration = unitWithProrationPrice.billingCycleConfiguration + internal fun from(groupedAllocationPrice: GroupedAllocationPrice) = apply { + this.metadata = groupedAllocationPrice.metadata + this.id = groupedAllocationPrice.id + this.name = groupedAllocationPrice.name + this.externalPriceId = groupedAllocationPrice.externalPriceId + this.priceType = groupedAllocationPrice.priceType + this.modelType = groupedAllocationPrice.modelType + this.createdAt = groupedAllocationPrice.createdAt + this.cadence = groupedAllocationPrice.cadence + this.billingCycleConfiguration = groupedAllocationPrice.billingCycleConfiguration this.invoicingCycleConfiguration = - unitWithProrationPrice.invoicingCycleConfiguration - this.billableMetric = unitWithProrationPrice.billableMetric - this.fixedPriceQuantity = unitWithProrationPrice.fixedPriceQuantity - this.planPhaseOrder = unitWithProrationPrice.planPhaseOrder - this.currency = unitWithProrationPrice.currency - this.conversionRate = unitWithProrationPrice.conversionRate - this.item = unitWithProrationPrice.item - this.creditAllocation = unitWithProrationPrice.creditAllocation - this.discount = unitWithProrationPrice.discount - this.minimum = unitWithProrationPrice.minimum - this.minimumAmount = unitWithProrationPrice.minimumAmount - this.maximum = unitWithProrationPrice.maximum - this.maximumAmount = unitWithProrationPrice.maximumAmount - this.unitWithProrationConfig = unitWithProrationPrice.unitWithProrationConfig - additionalProperties(unitWithProrationPrice.additionalProperties) + groupedAllocationPrice.invoicingCycleConfiguration + this.billableMetric = groupedAllocationPrice.billableMetric + this.fixedPriceQuantity = groupedAllocationPrice.fixedPriceQuantity + this.planPhaseOrder = groupedAllocationPrice.planPhaseOrder + this.currency = groupedAllocationPrice.currency + this.conversionRate = groupedAllocationPrice.conversionRate + this.item = groupedAllocationPrice.item + this.creditAllocation = groupedAllocationPrice.creditAllocation + this.discount = groupedAllocationPrice.discount + this.minimum = groupedAllocationPrice.minimum + this.minimumAmount = groupedAllocationPrice.minimumAmount + this.maximum = groupedAllocationPrice.maximum + this.maximumAmount = groupedAllocationPrice.maximumAmount + this.groupedAllocationConfig = groupedAllocationPrice.groupedAllocationConfig + additionalProperties(groupedAllocationPrice.additionalProperties) } /** @@ -32209,14 +33995,14 @@ private constructor( this.maximumAmount = maximumAmount } - fun unitWithProrationConfig(unitWithProrationConfig: UnitWithProrationConfig) = - unitWithProrationConfig(JsonField.of(unitWithProrationConfig)) + fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = + groupedAllocationConfig(JsonField.of(groupedAllocationConfig)) - @JsonProperty("unit_with_proration_config") + @JsonProperty("grouped_allocation_config") @ExcludeMissing - fun unitWithProrationConfig( - unitWithProrationConfig: JsonField - ) = apply { this.unitWithProrationConfig = unitWithProrationConfig } + fun groupedAllocationConfig( + groupedAllocationConfig: JsonField + ) = apply { this.groupedAllocationConfig = groupedAllocationConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -32232,8 +34018,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): UnitWithProrationPrice = - UnitWithProrationPrice( + fun build(): GroupedAllocationPrice = + GroupedAllocationPrice( metadata, id, name, @@ -32256,7 +34042,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - unitWithProrationConfig, + groupedAllocationConfig, additionalProperties.toImmutable(), ) } @@ -32707,6 +34493,81 @@ private constructor( "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" } + @JsonDeserialize(builder = GroupedAllocationConfig.Builder::class) + @NoAutoDetect + class GroupedAllocationConfig + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): GroupedAllocationConfig = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(groupedAllocationConfig: GroupedAllocationConfig) = apply { + additionalProperties(groupedAllocationConfig.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): GroupedAllocationConfig = + GroupedAllocationConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is GroupedAllocationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "GroupedAllocationConfig{additionalProperties=$additionalProperties}" + } + @JsonDeserialize(builder = InvoicingCycleConfiguration.Builder::class) @NoAutoDetect class InvoicingCycleConfiguration @@ -33354,29 +35215,29 @@ private constructor( companion object { - @JvmField val UNIT_WITH_PRORATION = ModelType(JsonField.of("unit_with_proration")) + @JvmField val GROUPED_ALLOCATION = ModelType(JsonField.of("grouped_allocation")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - UNIT_WITH_PRORATION, + GROUPED_ALLOCATION, } enum class Value { - UNIT_WITH_PRORATION, + GROUPED_ALLOCATION, _UNKNOWN, } fun value(): Value = when (this) { - UNIT_WITH_PRORATION -> Value.UNIT_WITH_PRORATION + GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION else -> Value._UNKNOWN } fun known(): Known = when (this) { - UNIT_WITH_PRORATION -> Known.UNIT_WITH_PRORATION + GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -33440,105 +35301,30 @@ private constructor( fun asString(): String = _value().asStringOrThrow() } - @JsonDeserialize(builder = UnitWithProrationConfig.Builder::class) - @NoAutoDetect - class UnitWithProrationConfig - private constructor( - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): UnitWithProrationConfig = apply { - if (!validated) { - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(unitWithProrationConfig: UnitWithProrationConfig) = apply { - additionalProperties(unitWithProrationConfig.additionalProperties) - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): UnitWithProrationConfig = - UnitWithProrationConfig(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is UnitWithProrationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "UnitWithProrationConfig{additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is UnitWithProrationPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.unitWithProrationConfig == other.unitWithProrationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedAllocationPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.groupedAllocationConfig == other.groupedAllocationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, unitWithProrationConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedAllocationConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "UnitWithProrationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, unitWithProrationConfig=$unitWithProrationConfig, additionalProperties=$additionalProperties}" + "GroupedAllocationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedAllocationConfig=$groupedAllocationConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = GroupedAllocationPrice.Builder::class) + @JsonDeserialize(builder = GroupedWithProratedMinimumPrice.Builder::class) @NoAutoDetect - class GroupedAllocationPrice + class GroupedWithProratedMinimumPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -33562,7 +35348,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val groupedAllocationConfig: JsonField, + private val groupedWithProratedMinimumConfig: JsonField, private val additionalProperties: Map, ) { @@ -33629,8 +35415,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun groupedAllocationConfig(): GroupedAllocationConfig = - groupedAllocationConfig.getRequired("grouped_allocation_config") + fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = + groupedWithProratedMinimumConfig.getRequired("grouped_with_prorated_minimum_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -33689,15 +35475,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("grouped_allocation_config") + @JsonProperty("grouped_with_prorated_minimum_config") @ExcludeMissing - fun _groupedAllocationConfig() = groupedAllocationConfig + fun _groupedWithProratedMinimumConfig() = groupedWithProratedMinimumConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): GroupedAllocationPrice = apply { + fun validate(): GroupedWithProratedMinimumPrice = apply { if (!validated) { metadata().validate() id() @@ -33721,7 +35507,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - groupedAllocationConfig().validate() + groupedWithProratedMinimumConfig().validate() validated = true } } @@ -33759,38 +35545,42 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var groupedAllocationConfig: JsonField = + private var groupedWithProratedMinimumConfig: + JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedAllocationPrice: GroupedAllocationPrice) = apply { - this.metadata = groupedAllocationPrice.metadata - this.id = groupedAllocationPrice.id - this.name = groupedAllocationPrice.name - this.externalPriceId = groupedAllocationPrice.externalPriceId - this.priceType = groupedAllocationPrice.priceType - this.modelType = groupedAllocationPrice.modelType - this.createdAt = groupedAllocationPrice.createdAt - this.cadence = groupedAllocationPrice.cadence - this.billingCycleConfiguration = groupedAllocationPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = - groupedAllocationPrice.invoicingCycleConfiguration - this.billableMetric = groupedAllocationPrice.billableMetric - this.fixedPriceQuantity = groupedAllocationPrice.fixedPriceQuantity - this.planPhaseOrder = groupedAllocationPrice.planPhaseOrder - this.currency = groupedAllocationPrice.currency - this.conversionRate = groupedAllocationPrice.conversionRate - this.item = groupedAllocationPrice.item - this.creditAllocation = groupedAllocationPrice.creditAllocation - this.discount = groupedAllocationPrice.discount - this.minimum = groupedAllocationPrice.minimum - this.minimumAmount = groupedAllocationPrice.minimumAmount - this.maximum = groupedAllocationPrice.maximum - this.maximumAmount = groupedAllocationPrice.maximumAmount - this.groupedAllocationConfig = groupedAllocationPrice.groupedAllocationConfig - additionalProperties(groupedAllocationPrice.additionalProperties) - } + internal fun from(groupedWithProratedMinimumPrice: GroupedWithProratedMinimumPrice) = + apply { + this.metadata = groupedWithProratedMinimumPrice.metadata + this.id = groupedWithProratedMinimumPrice.id + this.name = groupedWithProratedMinimumPrice.name + this.externalPriceId = groupedWithProratedMinimumPrice.externalPriceId + this.priceType = groupedWithProratedMinimumPrice.priceType + this.modelType = groupedWithProratedMinimumPrice.modelType + this.createdAt = groupedWithProratedMinimumPrice.createdAt + this.cadence = groupedWithProratedMinimumPrice.cadence + this.billingCycleConfiguration = + groupedWithProratedMinimumPrice.billingCycleConfiguration + this.invoicingCycleConfiguration = + groupedWithProratedMinimumPrice.invoicingCycleConfiguration + this.billableMetric = groupedWithProratedMinimumPrice.billableMetric + this.fixedPriceQuantity = groupedWithProratedMinimumPrice.fixedPriceQuantity + this.planPhaseOrder = groupedWithProratedMinimumPrice.planPhaseOrder + this.currency = groupedWithProratedMinimumPrice.currency + this.conversionRate = groupedWithProratedMinimumPrice.conversionRate + this.item = groupedWithProratedMinimumPrice.item + this.creditAllocation = groupedWithProratedMinimumPrice.creditAllocation + this.discount = groupedWithProratedMinimumPrice.discount + this.minimum = groupedWithProratedMinimumPrice.minimum + this.minimumAmount = groupedWithProratedMinimumPrice.minimumAmount + this.maximum = groupedWithProratedMinimumPrice.maximum + this.maximumAmount = groupedWithProratedMinimumPrice.maximumAmount + this.groupedWithProratedMinimumConfig = + groupedWithProratedMinimumPrice.groupedWithProratedMinimumConfig + additionalProperties(groupedWithProratedMinimumPrice.additionalProperties) + } /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -33964,14 +35754,15 @@ private constructor( this.maximumAmount = maximumAmount } - fun groupedAllocationConfig(groupedAllocationConfig: GroupedAllocationConfig) = - groupedAllocationConfig(JsonField.of(groupedAllocationConfig)) + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = groupedWithProratedMinimumConfig(JsonField.of(groupedWithProratedMinimumConfig)) - @JsonProperty("grouped_allocation_config") + @JsonProperty("grouped_with_prorated_minimum_config") @ExcludeMissing - fun groupedAllocationConfig( - groupedAllocationConfig: JsonField - ) = apply { this.groupedAllocationConfig = groupedAllocationConfig } + fun groupedWithProratedMinimumConfig( + groupedWithProratedMinimumConfig: JsonField + ) = apply { this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -33987,8 +35778,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): GroupedAllocationPrice = - GroupedAllocationPrice( + fun build(): GroupedWithProratedMinimumPrice = + GroupedWithProratedMinimumPrice( metadata, id, name, @@ -34011,7 +35802,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - groupedAllocationConfig, + groupedWithProratedMinimumConfig, additionalProperties.toImmutable(), ) } @@ -34462,9 +36253,9 @@ private constructor( "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = GroupedAllocationConfig.Builder::class) + @JsonDeserialize(builder = GroupedWithProratedMinimumConfig.Builder::class) @NoAutoDetect - class GroupedAllocationConfig + class GroupedWithProratedMinimumConfig private constructor( private val additionalProperties: Map, ) { @@ -34475,7 +36266,7 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): GroupedAllocationConfig = apply { + fun validate(): GroupedWithProratedMinimumConfig = apply { if (!validated) { validated = true } @@ -34493,8 +36284,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedAllocationConfig: GroupedAllocationConfig) = apply { - additionalProperties(groupedAllocationConfig.additionalProperties) + internal fun from( + groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + ) = apply { + additionalProperties(groupedWithProratedMinimumConfig.additionalProperties) } fun additionalProperties(additionalProperties: Map) = apply { @@ -34512,8 +36305,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): GroupedAllocationConfig = - GroupedAllocationConfig(additionalProperties.toImmutable()) + fun build(): GroupedWithProratedMinimumConfig = + GroupedWithProratedMinimumConfig(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -34521,7 +36314,7 @@ private constructor( return true } - return /* spotless:off */ other is GroupedAllocationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithProratedMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 @@ -34534,7 +36327,7 @@ private constructor( } override fun toString() = - "GroupedAllocationConfig{additionalProperties=$additionalProperties}" + "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" } @JsonDeserialize(builder = InvoicingCycleConfiguration.Builder::class) @@ -35184,29 +36977,31 @@ private constructor( companion object { - @JvmField val GROUPED_ALLOCATION = ModelType(JsonField.of("grouped_allocation")) + @JvmField + val GROUPED_WITH_PRORATED_MINIMUM = + ModelType(JsonField.of("grouped_with_prorated_minimum")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - GROUPED_ALLOCATION, + GROUPED_WITH_PRORATED_MINIMUM, } enum class Value { - GROUPED_ALLOCATION, + GROUPED_WITH_PRORATED_MINIMUM, _UNKNOWN, } fun value(): Value = when (this) { - GROUPED_ALLOCATION -> Value.GROUPED_ALLOCATION + GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM else -> Value._UNKNOWN } fun known(): Known = when (this) { - GROUPED_ALLOCATION -> Known.GROUPED_ALLOCATION + GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -35275,25 +37070,25 @@ private constructor( return true } - return /* spotless:off */ other is GroupedAllocationPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.groupedAllocationConfig == other.groupedAllocationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithProratedMinimumPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedAllocationConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedWithProratedMinimumConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "GroupedAllocationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedAllocationConfig=$groupedAllocationConfig, additionalProperties=$additionalProperties}" + "GroupedWithProratedMinimumPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = GroupedWithProratedMinimumPrice.Builder::class) + @JsonDeserialize(builder = GroupedWithMeteredMinimumPrice.Builder::class) @NoAutoDetect - class GroupedWithProratedMinimumPrice + class GroupedWithMeteredMinimumPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -35317,7 +37112,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val groupedWithProratedMinimumConfig: JsonField, + private val groupedWithMeteredMinimumConfig: JsonField, private val additionalProperties: Map, ) { @@ -35384,8 +37179,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun groupedWithProratedMinimumConfig(): GroupedWithProratedMinimumConfig = - groupedWithProratedMinimumConfig.getRequired("grouped_with_prorated_minimum_config") + fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = + groupedWithMeteredMinimumConfig.getRequired("grouped_with_metered_minimum_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -35444,15 +37239,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("grouped_with_prorated_minimum_config") + @JsonProperty("grouped_with_metered_minimum_config") @ExcludeMissing - fun _groupedWithProratedMinimumConfig() = groupedWithProratedMinimumConfig + fun _groupedWithMeteredMinimumConfig() = groupedWithMeteredMinimumConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): GroupedWithProratedMinimumPrice = apply { + fun validate(): GroupedWithMeteredMinimumPrice = apply { if (!validated) { metadata().validate() id() @@ -35476,7 +37271,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - groupedWithProratedMinimumConfig().validate() + groupedWithMeteredMinimumConfig().validate() validated = true } } @@ -35514,41 +37309,41 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var groupedWithProratedMinimumConfig: - JsonField = + private var groupedWithMeteredMinimumConfig: + JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedWithProratedMinimumPrice: GroupedWithProratedMinimumPrice) = + internal fun from(groupedWithMeteredMinimumPrice: GroupedWithMeteredMinimumPrice) = apply { - this.metadata = groupedWithProratedMinimumPrice.metadata - this.id = groupedWithProratedMinimumPrice.id - this.name = groupedWithProratedMinimumPrice.name - this.externalPriceId = groupedWithProratedMinimumPrice.externalPriceId - this.priceType = groupedWithProratedMinimumPrice.priceType - this.modelType = groupedWithProratedMinimumPrice.modelType - this.createdAt = groupedWithProratedMinimumPrice.createdAt - this.cadence = groupedWithProratedMinimumPrice.cadence + this.metadata = groupedWithMeteredMinimumPrice.metadata + this.id = groupedWithMeteredMinimumPrice.id + this.name = groupedWithMeteredMinimumPrice.name + this.externalPriceId = groupedWithMeteredMinimumPrice.externalPriceId + this.priceType = groupedWithMeteredMinimumPrice.priceType + this.modelType = groupedWithMeteredMinimumPrice.modelType + this.createdAt = groupedWithMeteredMinimumPrice.createdAt + this.cadence = groupedWithMeteredMinimumPrice.cadence this.billingCycleConfiguration = - groupedWithProratedMinimumPrice.billingCycleConfiguration + groupedWithMeteredMinimumPrice.billingCycleConfiguration this.invoicingCycleConfiguration = - groupedWithProratedMinimumPrice.invoicingCycleConfiguration - this.billableMetric = groupedWithProratedMinimumPrice.billableMetric - this.fixedPriceQuantity = groupedWithProratedMinimumPrice.fixedPriceQuantity - this.planPhaseOrder = groupedWithProratedMinimumPrice.planPhaseOrder - this.currency = groupedWithProratedMinimumPrice.currency - this.conversionRate = groupedWithProratedMinimumPrice.conversionRate - this.item = groupedWithProratedMinimumPrice.item - this.creditAllocation = groupedWithProratedMinimumPrice.creditAllocation - this.discount = groupedWithProratedMinimumPrice.discount - this.minimum = groupedWithProratedMinimumPrice.minimum - this.minimumAmount = groupedWithProratedMinimumPrice.minimumAmount - this.maximum = groupedWithProratedMinimumPrice.maximum - this.maximumAmount = groupedWithProratedMinimumPrice.maximumAmount - this.groupedWithProratedMinimumConfig = - groupedWithProratedMinimumPrice.groupedWithProratedMinimumConfig - additionalProperties(groupedWithProratedMinimumPrice.additionalProperties) + groupedWithMeteredMinimumPrice.invoicingCycleConfiguration + this.billableMetric = groupedWithMeteredMinimumPrice.billableMetric + this.fixedPriceQuantity = groupedWithMeteredMinimumPrice.fixedPriceQuantity + this.planPhaseOrder = groupedWithMeteredMinimumPrice.planPhaseOrder + this.currency = groupedWithMeteredMinimumPrice.currency + this.conversionRate = groupedWithMeteredMinimumPrice.conversionRate + this.item = groupedWithMeteredMinimumPrice.item + this.creditAllocation = groupedWithMeteredMinimumPrice.creditAllocation + this.discount = groupedWithMeteredMinimumPrice.discount + this.minimum = groupedWithMeteredMinimumPrice.minimum + this.minimumAmount = groupedWithMeteredMinimumPrice.minimumAmount + this.maximum = groupedWithMeteredMinimumPrice.maximum + this.maximumAmount = groupedWithMeteredMinimumPrice.maximumAmount + this.groupedWithMeteredMinimumConfig = + groupedWithMeteredMinimumPrice.groupedWithMeteredMinimumConfig + additionalProperties(groupedWithMeteredMinimumPrice.additionalProperties) } /** @@ -35723,15 +37518,15 @@ private constructor( this.maximumAmount = maximumAmount } - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig - ) = groupedWithProratedMinimumConfig(JsonField.of(groupedWithProratedMinimumConfig)) + fun groupedWithMeteredMinimumConfig( + groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig + ) = groupedWithMeteredMinimumConfig(JsonField.of(groupedWithMeteredMinimumConfig)) - @JsonProperty("grouped_with_prorated_minimum_config") + @JsonProperty("grouped_with_metered_minimum_config") @ExcludeMissing - fun groupedWithProratedMinimumConfig( - groupedWithProratedMinimumConfig: JsonField - ) = apply { this.groupedWithProratedMinimumConfig = groupedWithProratedMinimumConfig } + fun groupedWithMeteredMinimumConfig( + groupedWithMeteredMinimumConfig: JsonField + ) = apply { this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -35747,8 +37542,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): GroupedWithProratedMinimumPrice = - GroupedWithProratedMinimumPrice( + fun build(): GroupedWithMeteredMinimumPrice = + GroupedWithMeteredMinimumPrice( metadata, id, name, @@ -35771,7 +37566,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - groupedWithProratedMinimumConfig, + groupedWithMeteredMinimumConfig, additionalProperties.toImmutable(), ) } @@ -36222,9 +38017,9 @@ private constructor( "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = GroupedWithProratedMinimumConfig.Builder::class) + @JsonDeserialize(builder = GroupedWithMeteredMinimumConfig.Builder::class) @NoAutoDetect - class GroupedWithProratedMinimumConfig + class GroupedWithMeteredMinimumConfig private constructor( private val additionalProperties: Map, ) { @@ -36235,7 +38030,7 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): GroupedWithProratedMinimumConfig = apply { + fun validate(): GroupedWithMeteredMinimumConfig = apply { if (!validated) { validated = true } @@ -36254,9 +38049,9 @@ private constructor( @JvmSynthetic internal fun from( - groupedWithProratedMinimumConfig: GroupedWithProratedMinimumConfig + groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig ) = apply { - additionalProperties(groupedWithProratedMinimumConfig.additionalProperties) + additionalProperties(groupedWithMeteredMinimumConfig.additionalProperties) } fun additionalProperties(additionalProperties: Map) = apply { @@ -36274,8 +38069,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): GroupedWithProratedMinimumConfig = - GroupedWithProratedMinimumConfig(additionalProperties.toImmutable()) + fun build(): GroupedWithMeteredMinimumConfig = + GroupedWithMeteredMinimumConfig(additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -36283,7 +38078,7 @@ private constructor( return true } - return /* spotless:off */ other is GroupedWithProratedMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithMeteredMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 @@ -36296,7 +38091,7 @@ private constructor( } override fun toString() = - "GroupedWithProratedMinimumConfig{additionalProperties=$additionalProperties}" + "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" } @JsonDeserialize(builder = InvoicingCycleConfiguration.Builder::class) @@ -36947,30 +38742,30 @@ private constructor( companion object { @JvmField - val GROUPED_WITH_PRORATED_MINIMUM = - ModelType(JsonField.of("grouped_with_prorated_minimum")) + val GROUPED_WITH_METERED_MINIMUM = + ModelType(JsonField.of("grouped_with_metered_minimum")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - GROUPED_WITH_PRORATED_MINIMUM, + GROUPED_WITH_METERED_MINIMUM, } enum class Value { - GROUPED_WITH_PRORATED_MINIMUM, + GROUPED_WITH_METERED_MINIMUM, _UNKNOWN, } fun value(): Value = when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Value.GROUPED_WITH_PRORATED_MINIMUM + GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM else -> Value._UNKNOWN } fun known(): Known = when (this) { - GROUPED_WITH_PRORATED_MINIMUM -> Known.GROUPED_WITH_PRORATED_MINIMUM + GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -37039,25 +38834,25 @@ private constructor( return true } - return /* spotless:off */ other is GroupedWithProratedMinimumPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.groupedWithProratedMinimumConfig == other.groupedWithProratedMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedWithMeteredMinimumPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedWithProratedMinimumConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedWithMeteredMinimumConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "GroupedWithProratedMinimumPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedWithProratedMinimumConfig=$groupedWithProratedMinimumConfig, additionalProperties=$additionalProperties}" + "GroupedWithMeteredMinimumPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = GroupedWithMeteredMinimumPrice.Builder::class) + @JsonDeserialize(builder = MatrixWithDisplayNamePrice.Builder::class) @NoAutoDetect - class GroupedWithMeteredMinimumPrice + class MatrixWithDisplayNamePrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -37081,7 +38876,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val groupedWithMeteredMinimumConfig: JsonField, + private val matrixWithDisplayNameConfig: JsonField, private val additionalProperties: Map, ) { @@ -37148,8 +38943,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun groupedWithMeteredMinimumConfig(): GroupedWithMeteredMinimumConfig = - groupedWithMeteredMinimumConfig.getRequired("grouped_with_metered_minimum_config") + fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = + matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -37208,15 +39003,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("grouped_with_metered_minimum_config") + @JsonProperty("matrix_with_display_name_config") @ExcludeMissing - fun _groupedWithMeteredMinimumConfig() = groupedWithMeteredMinimumConfig + fun _matrixWithDisplayNameConfig() = matrixWithDisplayNameConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): GroupedWithMeteredMinimumPrice = apply { + fun validate(): MatrixWithDisplayNamePrice = apply { if (!validated) { metadata().validate() id() @@ -37240,7 +39035,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - groupedWithMeteredMinimumConfig().validate() + matrixWithDisplayNameConfig().validate() validated = true } } @@ -37278,42 +39073,40 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var groupedWithMeteredMinimumConfig: - JsonField = + private var matrixWithDisplayNameConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(groupedWithMeteredMinimumPrice: GroupedWithMeteredMinimumPrice) = - apply { - this.metadata = groupedWithMeteredMinimumPrice.metadata - this.id = groupedWithMeteredMinimumPrice.id - this.name = groupedWithMeteredMinimumPrice.name - this.externalPriceId = groupedWithMeteredMinimumPrice.externalPriceId - this.priceType = groupedWithMeteredMinimumPrice.priceType - this.modelType = groupedWithMeteredMinimumPrice.modelType - this.createdAt = groupedWithMeteredMinimumPrice.createdAt - this.cadence = groupedWithMeteredMinimumPrice.cadence - this.billingCycleConfiguration = - groupedWithMeteredMinimumPrice.billingCycleConfiguration - this.invoicingCycleConfiguration = - groupedWithMeteredMinimumPrice.invoicingCycleConfiguration - this.billableMetric = groupedWithMeteredMinimumPrice.billableMetric - this.fixedPriceQuantity = groupedWithMeteredMinimumPrice.fixedPriceQuantity - this.planPhaseOrder = groupedWithMeteredMinimumPrice.planPhaseOrder - this.currency = groupedWithMeteredMinimumPrice.currency - this.conversionRate = groupedWithMeteredMinimumPrice.conversionRate - this.item = groupedWithMeteredMinimumPrice.item - this.creditAllocation = groupedWithMeteredMinimumPrice.creditAllocation - this.discount = groupedWithMeteredMinimumPrice.discount - this.minimum = groupedWithMeteredMinimumPrice.minimum - this.minimumAmount = groupedWithMeteredMinimumPrice.minimumAmount - this.maximum = groupedWithMeteredMinimumPrice.maximum - this.maximumAmount = groupedWithMeteredMinimumPrice.maximumAmount - this.groupedWithMeteredMinimumConfig = - groupedWithMeteredMinimumPrice.groupedWithMeteredMinimumConfig - additionalProperties(groupedWithMeteredMinimumPrice.additionalProperties) - } + internal fun from(matrixWithDisplayNamePrice: MatrixWithDisplayNamePrice) = apply { + this.metadata = matrixWithDisplayNamePrice.metadata + this.id = matrixWithDisplayNamePrice.id + this.name = matrixWithDisplayNamePrice.name + this.externalPriceId = matrixWithDisplayNamePrice.externalPriceId + this.priceType = matrixWithDisplayNamePrice.priceType + this.modelType = matrixWithDisplayNamePrice.modelType + this.createdAt = matrixWithDisplayNamePrice.createdAt + this.cadence = matrixWithDisplayNamePrice.cadence + this.billingCycleConfiguration = + matrixWithDisplayNamePrice.billingCycleConfiguration + this.invoicingCycleConfiguration = + matrixWithDisplayNamePrice.invoicingCycleConfiguration + this.billableMetric = matrixWithDisplayNamePrice.billableMetric + this.fixedPriceQuantity = matrixWithDisplayNamePrice.fixedPriceQuantity + this.planPhaseOrder = matrixWithDisplayNamePrice.planPhaseOrder + this.currency = matrixWithDisplayNamePrice.currency + this.conversionRate = matrixWithDisplayNamePrice.conversionRate + this.item = matrixWithDisplayNamePrice.item + this.creditAllocation = matrixWithDisplayNamePrice.creditAllocation + this.discount = matrixWithDisplayNamePrice.discount + this.minimum = matrixWithDisplayNamePrice.minimum + this.minimumAmount = matrixWithDisplayNamePrice.minimumAmount + this.maximum = matrixWithDisplayNamePrice.maximum + this.maximumAmount = matrixWithDisplayNamePrice.maximumAmount + this.matrixWithDisplayNameConfig = + matrixWithDisplayNamePrice.matrixWithDisplayNameConfig + additionalProperties(matrixWithDisplayNamePrice.additionalProperties) + } /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -37487,15 +39280,15 @@ private constructor( this.maximumAmount = maximumAmount } - fun groupedWithMeteredMinimumConfig( - groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig - ) = groupedWithMeteredMinimumConfig(JsonField.of(groupedWithMeteredMinimumConfig)) + fun matrixWithDisplayNameConfig( + matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig + ) = matrixWithDisplayNameConfig(JsonField.of(matrixWithDisplayNameConfig)) - @JsonProperty("grouped_with_metered_minimum_config") + @JsonProperty("matrix_with_display_name_config") @ExcludeMissing - fun groupedWithMeteredMinimumConfig( - groupedWithMeteredMinimumConfig: JsonField - ) = apply { this.groupedWithMeteredMinimumConfig = groupedWithMeteredMinimumConfig } + fun matrixWithDisplayNameConfig( + matrixWithDisplayNameConfig: JsonField + ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -37511,8 +39304,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): GroupedWithMeteredMinimumPrice = - GroupedWithMeteredMinimumPrice( + fun build(): MatrixWithDisplayNamePrice = + MatrixWithDisplayNamePrice( metadata, id, name, @@ -37535,7 +39328,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - groupedWithMeteredMinimumConfig, + matrixWithDisplayNameConfig, additionalProperties.toImmutable(), ) } @@ -37986,83 +39779,6 @@ private constructor( "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = GroupedWithMeteredMinimumConfig.Builder::class) - @NoAutoDetect - class GroupedWithMeteredMinimumConfig - private constructor( - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): GroupedWithMeteredMinimumConfig = apply { - if (!validated) { - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - groupedWithMeteredMinimumConfig: GroupedWithMeteredMinimumConfig - ) = apply { - additionalProperties(groupedWithMeteredMinimumConfig.additionalProperties) - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): GroupedWithMeteredMinimumConfig = - GroupedWithMeteredMinimumConfig(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is GroupedWithMeteredMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "GroupedWithMeteredMinimumConfig{additionalProperties=$additionalProperties}" - } - @JsonDeserialize(builder = InvoicingCycleConfiguration.Builder::class) @NoAutoDetect class InvoicingCycleConfiguration @@ -38338,6 +40054,82 @@ private constructor( "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" } + @JsonDeserialize(builder = MatrixWithDisplayNameConfig.Builder::class) + @NoAutoDetect + class MatrixWithDisplayNameConfig + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): MatrixWithDisplayNameConfig = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig) = + apply { + additionalProperties(matrixWithDisplayNameConfig.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): MatrixWithDisplayNameConfig = + MatrixWithDisplayNameConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is MatrixWithDisplayNameConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" + } + @JsonDeserialize(builder = Maximum.Builder::class) @NoAutoDetect class Maximum @@ -38711,30 +40503,29 @@ private constructor( companion object { @JvmField - val GROUPED_WITH_METERED_MINIMUM = - ModelType(JsonField.of("grouped_with_metered_minimum")) + val MATRIX_WITH_DISPLAY_NAME = ModelType(JsonField.of("matrix_with_display_name")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - GROUPED_WITH_METERED_MINIMUM, + MATRIX_WITH_DISPLAY_NAME, } enum class Value { - GROUPED_WITH_METERED_MINIMUM, + MATRIX_WITH_DISPLAY_NAME, _UNKNOWN, } fun value(): Value = when (this) { - GROUPED_WITH_METERED_MINIMUM -> Value.GROUPED_WITH_METERED_MINIMUM + MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME else -> Value._UNKNOWN } fun known(): Known = when (this) { - GROUPED_WITH_METERED_MINIMUM -> Known.GROUPED_WITH_METERED_MINIMUM + MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -38803,25 +40594,25 @@ private constructor( return true } - return /* spotless:off */ other is GroupedWithMeteredMinimumPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.groupedWithMeteredMinimumConfig == other.groupedWithMeteredMinimumConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is MatrixWithDisplayNamePrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedWithMeteredMinimumConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, matrixWithDisplayNameConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "GroupedWithMeteredMinimumPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedWithMeteredMinimumConfig=$groupedWithMeteredMinimumConfig, additionalProperties=$additionalProperties}" + "MatrixWithDisplayNamePrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = MatrixWithDisplayNamePrice.Builder::class) + @JsonDeserialize(builder = BulkWithProrationPrice.Builder::class) @NoAutoDetect - class MatrixWithDisplayNamePrice + class BulkWithProrationPrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -38845,7 +40636,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val matrixWithDisplayNameConfig: JsonField, + private val bulkWithProrationConfig: JsonField, private val additionalProperties: Map, ) { @@ -38912,8 +40703,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun matrixWithDisplayNameConfig(): MatrixWithDisplayNameConfig = - matrixWithDisplayNameConfig.getRequired("matrix_with_display_name_config") + fun bulkWithProrationConfig(): BulkWithProrationConfig = + bulkWithProrationConfig.getRequired("bulk_with_proration_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -38972,15 +40763,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("matrix_with_display_name_config") + @JsonProperty("bulk_with_proration_config") @ExcludeMissing - fun _matrixWithDisplayNameConfig() = matrixWithDisplayNameConfig + fun _bulkWithProrationConfig() = bulkWithProrationConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): MatrixWithDisplayNamePrice = apply { + fun validate(): BulkWithProrationPrice = apply { if (!validated) { metadata().validate() id() @@ -39004,7 +40795,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - matrixWithDisplayNameConfig().validate() + bulkWithProrationConfig().validate() validated = true } } @@ -39042,39 +40833,37 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var matrixWithDisplayNameConfig: JsonField = + private var bulkWithProrationConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(matrixWithDisplayNamePrice: MatrixWithDisplayNamePrice) = apply { - this.metadata = matrixWithDisplayNamePrice.metadata - this.id = matrixWithDisplayNamePrice.id - this.name = matrixWithDisplayNamePrice.name - this.externalPriceId = matrixWithDisplayNamePrice.externalPriceId - this.priceType = matrixWithDisplayNamePrice.priceType - this.modelType = matrixWithDisplayNamePrice.modelType - this.createdAt = matrixWithDisplayNamePrice.createdAt - this.cadence = matrixWithDisplayNamePrice.cadence - this.billingCycleConfiguration = - matrixWithDisplayNamePrice.billingCycleConfiguration + internal fun from(bulkWithProrationPrice: BulkWithProrationPrice) = apply { + this.metadata = bulkWithProrationPrice.metadata + this.id = bulkWithProrationPrice.id + this.name = bulkWithProrationPrice.name + this.externalPriceId = bulkWithProrationPrice.externalPriceId + this.priceType = bulkWithProrationPrice.priceType + this.modelType = bulkWithProrationPrice.modelType + this.createdAt = bulkWithProrationPrice.createdAt + this.cadence = bulkWithProrationPrice.cadence + this.billingCycleConfiguration = bulkWithProrationPrice.billingCycleConfiguration this.invoicingCycleConfiguration = - matrixWithDisplayNamePrice.invoicingCycleConfiguration - this.billableMetric = matrixWithDisplayNamePrice.billableMetric - this.fixedPriceQuantity = matrixWithDisplayNamePrice.fixedPriceQuantity - this.planPhaseOrder = matrixWithDisplayNamePrice.planPhaseOrder - this.currency = matrixWithDisplayNamePrice.currency - this.conversionRate = matrixWithDisplayNamePrice.conversionRate - this.item = matrixWithDisplayNamePrice.item - this.creditAllocation = matrixWithDisplayNamePrice.creditAllocation - this.discount = matrixWithDisplayNamePrice.discount - this.minimum = matrixWithDisplayNamePrice.minimum - this.minimumAmount = matrixWithDisplayNamePrice.minimumAmount - this.maximum = matrixWithDisplayNamePrice.maximum - this.maximumAmount = matrixWithDisplayNamePrice.maximumAmount - this.matrixWithDisplayNameConfig = - matrixWithDisplayNamePrice.matrixWithDisplayNameConfig - additionalProperties(matrixWithDisplayNamePrice.additionalProperties) + bulkWithProrationPrice.invoicingCycleConfiguration + this.billableMetric = bulkWithProrationPrice.billableMetric + this.fixedPriceQuantity = bulkWithProrationPrice.fixedPriceQuantity + this.planPhaseOrder = bulkWithProrationPrice.planPhaseOrder + this.currency = bulkWithProrationPrice.currency + this.conversionRate = bulkWithProrationPrice.conversionRate + this.item = bulkWithProrationPrice.item + this.creditAllocation = bulkWithProrationPrice.creditAllocation + this.discount = bulkWithProrationPrice.discount + this.minimum = bulkWithProrationPrice.minimum + this.minimumAmount = bulkWithProrationPrice.minimumAmount + this.maximum = bulkWithProrationPrice.maximum + this.maximumAmount = bulkWithProrationPrice.maximumAmount + this.bulkWithProrationConfig = bulkWithProrationPrice.bulkWithProrationConfig + additionalProperties(bulkWithProrationPrice.additionalProperties) } /** @@ -39249,15 +41038,14 @@ private constructor( this.maximumAmount = maximumAmount } - fun matrixWithDisplayNameConfig( - matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig - ) = matrixWithDisplayNameConfig(JsonField.of(matrixWithDisplayNameConfig)) + fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = + bulkWithProrationConfig(JsonField.of(bulkWithProrationConfig)) - @JsonProperty("matrix_with_display_name_config") + @JsonProperty("bulk_with_proration_config") @ExcludeMissing - fun matrixWithDisplayNameConfig( - matrixWithDisplayNameConfig: JsonField - ) = apply { this.matrixWithDisplayNameConfig = matrixWithDisplayNameConfig } + fun bulkWithProrationConfig( + bulkWithProrationConfig: JsonField + ) = apply { this.bulkWithProrationConfig = bulkWithProrationConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -39273,8 +41061,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): MatrixWithDisplayNamePrice = - MatrixWithDisplayNamePrice( + fun build(): BulkWithProrationPrice = + BulkWithProrationPrice( metadata, id, name, @@ -39297,7 +41085,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - matrixWithDisplayNameConfig, + bulkWithProrationConfig, additionalProperties.toImmutable(), ) } @@ -39557,6 +41345,81 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } + @JsonDeserialize(builder = BulkWithProrationConfig.Builder::class) + @NoAutoDetect + class BulkWithProrationConfig + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): BulkWithProrationConfig = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(bulkWithProrationConfig: BulkWithProrationConfig) = apply { + additionalProperties(bulkWithProrationConfig.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): BulkWithProrationConfig = + BulkWithProrationConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BulkWithProrationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "BulkWithProrationConfig{additionalProperties=$additionalProperties}" + } + class Cadence @JsonCreator private constructor( @@ -40023,82 +41886,6 @@ private constructor( "Item{id=$id, name=$name, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = MatrixWithDisplayNameConfig.Builder::class) - @NoAutoDetect - class MatrixWithDisplayNameConfig - private constructor( - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): MatrixWithDisplayNameConfig = apply { - if (!validated) { - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(matrixWithDisplayNameConfig: MatrixWithDisplayNameConfig) = - apply { - additionalProperties(matrixWithDisplayNameConfig.additionalProperties) - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): MatrixWithDisplayNameConfig = - MatrixWithDisplayNameConfig(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is MatrixWithDisplayNameConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "MatrixWithDisplayNameConfig{additionalProperties=$additionalProperties}" - } - @JsonDeserialize(builder = Maximum.Builder::class) @NoAutoDetect class Maximum @@ -40471,30 +42258,29 @@ private constructor( companion object { - @JvmField - val MATRIX_WITH_DISPLAY_NAME = ModelType(JsonField.of("matrix_with_display_name")) + @JvmField val BULK_WITH_PRORATION = ModelType(JsonField.of("bulk_with_proration")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - MATRIX_WITH_DISPLAY_NAME, + BULK_WITH_PRORATION, } enum class Value { - MATRIX_WITH_DISPLAY_NAME, + BULK_WITH_PRORATION, _UNKNOWN, } fun value(): Value = when (this) { - MATRIX_WITH_DISPLAY_NAME -> Value.MATRIX_WITH_DISPLAY_NAME + BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION else -> Value._UNKNOWN } fun known(): Known = when (this) { - MATRIX_WITH_DISPLAY_NAME -> Known.MATRIX_WITH_DISPLAY_NAME + BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -40563,25 +42349,25 @@ private constructor( return true } - return /* spotless:off */ other is MatrixWithDisplayNamePrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.matrixWithDisplayNameConfig == other.matrixWithDisplayNameConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BulkWithProrationPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.bulkWithProrationConfig == other.bulkWithProrationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, matrixWithDisplayNameConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, bulkWithProrationConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "MatrixWithDisplayNamePrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, matrixWithDisplayNameConfig=$matrixWithDisplayNameConfig, additionalProperties=$additionalProperties}" + "BulkWithProrationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, bulkWithProrationConfig=$bulkWithProrationConfig, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = BulkWithProrationPrice.Builder::class) + @JsonDeserialize(builder = GroupedTieredPackagePrice.Builder::class) @NoAutoDetect - class BulkWithProrationPrice + class GroupedTieredPackagePrice private constructor( private val metadata: JsonField, private val id: JsonField, @@ -40605,7 +42391,7 @@ private constructor( private val minimumAmount: JsonField, private val maximum: JsonField, private val maximumAmount: JsonField, - private val bulkWithProrationConfig: JsonField, + private val groupedTieredPackageConfig: JsonField, private val additionalProperties: Map, ) { @@ -40672,8 +42458,8 @@ private constructor( fun maximumAmount(): Optional = Optional.ofNullable(maximumAmount.getNullable("maximum_amount")) - fun bulkWithProrationConfig(): BulkWithProrationConfig = - bulkWithProrationConfig.getRequired("bulk_with_proration_config") + fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = + groupedTieredPackageConfig.getRequired("grouped_tiered_package_config") /** * User specified key-value pairs for the resource. If not present, this defaults to an @@ -40732,15 +42518,15 @@ private constructor( @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount - @JsonProperty("bulk_with_proration_config") + @JsonProperty("grouped_tiered_package_config") @ExcludeMissing - fun _bulkWithProrationConfig() = bulkWithProrationConfig + fun _groupedTieredPackageConfig() = groupedTieredPackageConfig @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): BulkWithProrationPrice = apply { + fun validate(): GroupedTieredPackagePrice = apply { if (!validated) { metadata().validate() id() @@ -40764,7 +42550,7 @@ private constructor( minimumAmount() maximum().map { it.validate() } maximumAmount() - bulkWithProrationConfig().validate() + groupedTieredPackageConfig().validate() validated = true } } @@ -40802,37 +42588,38 @@ private constructor( private var minimumAmount: JsonField = JsonMissing.of() private var maximum: JsonField = JsonMissing.of() private var maximumAmount: JsonField = JsonMissing.of() - private var bulkWithProrationConfig: JsonField = + private var groupedTieredPackageConfig: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(bulkWithProrationPrice: BulkWithProrationPrice) = apply { - this.metadata = bulkWithProrationPrice.metadata - this.id = bulkWithProrationPrice.id - this.name = bulkWithProrationPrice.name - this.externalPriceId = bulkWithProrationPrice.externalPriceId - this.priceType = bulkWithProrationPrice.priceType - this.modelType = bulkWithProrationPrice.modelType - this.createdAt = bulkWithProrationPrice.createdAt - this.cadence = bulkWithProrationPrice.cadence - this.billingCycleConfiguration = bulkWithProrationPrice.billingCycleConfiguration + internal fun from(groupedTieredPackagePrice: GroupedTieredPackagePrice) = apply { + this.metadata = groupedTieredPackagePrice.metadata + this.id = groupedTieredPackagePrice.id + this.name = groupedTieredPackagePrice.name + this.externalPriceId = groupedTieredPackagePrice.externalPriceId + this.priceType = groupedTieredPackagePrice.priceType + this.modelType = groupedTieredPackagePrice.modelType + this.createdAt = groupedTieredPackagePrice.createdAt + this.cadence = groupedTieredPackagePrice.cadence + this.billingCycleConfiguration = groupedTieredPackagePrice.billingCycleConfiguration this.invoicingCycleConfiguration = - bulkWithProrationPrice.invoicingCycleConfiguration - this.billableMetric = bulkWithProrationPrice.billableMetric - this.fixedPriceQuantity = bulkWithProrationPrice.fixedPriceQuantity - this.planPhaseOrder = bulkWithProrationPrice.planPhaseOrder - this.currency = bulkWithProrationPrice.currency - this.conversionRate = bulkWithProrationPrice.conversionRate - this.item = bulkWithProrationPrice.item - this.creditAllocation = bulkWithProrationPrice.creditAllocation - this.discount = bulkWithProrationPrice.discount - this.minimum = bulkWithProrationPrice.minimum - this.minimumAmount = bulkWithProrationPrice.minimumAmount - this.maximum = bulkWithProrationPrice.maximum - this.maximumAmount = bulkWithProrationPrice.maximumAmount - this.bulkWithProrationConfig = bulkWithProrationPrice.bulkWithProrationConfig - additionalProperties(bulkWithProrationPrice.additionalProperties) + groupedTieredPackagePrice.invoicingCycleConfiguration + this.billableMetric = groupedTieredPackagePrice.billableMetric + this.fixedPriceQuantity = groupedTieredPackagePrice.fixedPriceQuantity + this.planPhaseOrder = groupedTieredPackagePrice.planPhaseOrder + this.currency = groupedTieredPackagePrice.currency + this.conversionRate = groupedTieredPackagePrice.conversionRate + this.item = groupedTieredPackagePrice.item + this.creditAllocation = groupedTieredPackagePrice.creditAllocation + this.discount = groupedTieredPackagePrice.discount + this.minimum = groupedTieredPackagePrice.minimum + this.minimumAmount = groupedTieredPackagePrice.minimumAmount + this.maximum = groupedTieredPackagePrice.maximum + this.maximumAmount = groupedTieredPackagePrice.maximumAmount + this.groupedTieredPackageConfig = + groupedTieredPackagePrice.groupedTieredPackageConfig + additionalProperties(groupedTieredPackagePrice.additionalProperties) } /** @@ -41007,14 +42794,14 @@ private constructor( this.maximumAmount = maximumAmount } - fun bulkWithProrationConfig(bulkWithProrationConfig: BulkWithProrationConfig) = - bulkWithProrationConfig(JsonField.of(bulkWithProrationConfig)) + fun groupedTieredPackageConfig(groupedTieredPackageConfig: GroupedTieredPackageConfig) = + groupedTieredPackageConfig(JsonField.of(groupedTieredPackageConfig)) - @JsonProperty("bulk_with_proration_config") + @JsonProperty("grouped_tiered_package_config") @ExcludeMissing - fun bulkWithProrationConfig( - bulkWithProrationConfig: JsonField - ) = apply { this.bulkWithProrationConfig = bulkWithProrationConfig } + fun groupedTieredPackageConfig( + groupedTieredPackageConfig: JsonField + ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -41030,8 +42817,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): BulkWithProrationPrice = - BulkWithProrationPrice( + fun build(): GroupedTieredPackagePrice = + GroupedTieredPackagePrice( metadata, id, name, @@ -41054,7 +42841,7 @@ private constructor( minimumAmount, maximum, maximumAmount, - bulkWithProrationConfig, + groupedTieredPackageConfig, additionalProperties.toImmutable(), ) } @@ -41314,81 +43101,6 @@ private constructor( "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = BulkWithProrationConfig.Builder::class) - @NoAutoDetect - class BulkWithProrationConfig - private constructor( - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): BulkWithProrationConfig = apply { - if (!validated) { - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(bulkWithProrationConfig: BulkWithProrationConfig) = apply { - additionalProperties(bulkWithProrationConfig.additionalProperties) - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) - } - - @JsonAnySetter - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun build(): BulkWithProrationConfig = - BulkWithProrationConfig(additionalProperties.toImmutable()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is BulkWithProrationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ - } - - private var hashCode: Int = 0 - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ - } - return hashCode - } - - override fun toString() = - "BulkWithProrationConfig{additionalProperties=$additionalProperties}" - } - class Cadence @JsonCreator private constructor( @@ -41580,6 +43292,81 @@ private constructor( "CreditAllocation{currency=$currency, allowsRollover=$allowsRollover, additionalProperties=$additionalProperties}" } + @JsonDeserialize(builder = GroupedTieredPackageConfig.Builder::class) + @NoAutoDetect + class GroupedTieredPackageConfig + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): GroupedTieredPackageConfig = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(groupedTieredPackageConfig: GroupedTieredPackageConfig) = apply { + additionalProperties(groupedTieredPackageConfig.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): GroupedTieredPackageConfig = + GroupedTieredPackageConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is GroupedTieredPackageConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" + } + @JsonDeserialize(builder = InvoicingCycleConfiguration.Builder::class) @NoAutoDetect class InvoicingCycleConfiguration @@ -42227,29 +44014,30 @@ private constructor( companion object { - @JvmField val BULK_WITH_PRORATION = ModelType(JsonField.of("bulk_with_proration")) + @JvmField + val GROUPED_TIERED_PACKAGE = ModelType(JsonField.of("grouped_tiered_package")) @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) } enum class Known { - BULK_WITH_PRORATION, + GROUPED_TIERED_PACKAGE, } enum class Value { - BULK_WITH_PRORATION, + GROUPED_TIERED_PACKAGE, _UNKNOWN, } fun value(): Value = when (this) { - BULK_WITH_PRORATION -> Value.BULK_WITH_PRORATION + GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE else -> Value._UNKNOWN } fun known(): Known = when (this) { - BULK_WITH_PRORATION -> Known.BULK_WITH_PRORATION + GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE else -> throw OrbInvalidDataException("Unknown ModelType: $value") } @@ -42318,19 +44106,19 @@ private constructor( return true } - return /* spotless:off */ other is BulkWithProrationPrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.bulkWithProrationConfig == other.bulkWithProrationConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is GroupedTieredPackagePrice && this.metadata == other.metadata && this.id == other.id && this.name == other.name && this.externalPriceId == other.externalPriceId && this.priceType == other.priceType && this.modelType == other.modelType && this.createdAt == other.createdAt && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.billableMetric == other.billableMetric && this.fixedPriceQuantity == other.fixedPriceQuantity && this.planPhaseOrder == other.planPhaseOrder && this.currency == other.currency && this.conversionRate == other.conversionRate && this.item == other.item && this.creditAllocation == other.creditAllocation && this.discount == other.discount && this.minimum == other.minimum && this.minimumAmount == other.minimumAmount && this.maximum == other.maximum && this.maximumAmount == other.maximumAmount && this.groupedTieredPackageConfig == other.groupedTieredPackageConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { - hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, bulkWithProrationConfig, additionalProperties) /* spotless:on */ + hashCode = /* spotless:off */ Objects.hash(metadata, id, name, externalPriceId, priceType, modelType, createdAt, cadence, billingCycleConfiguration, invoicingCycleConfiguration, billableMetric, fixedPriceQuantity, planPhaseOrder, currency, conversionRate, item, creditAllocation, discount, minimum, minimumAmount, maximum, maximumAmount, groupedTieredPackageConfig, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = - "BulkWithProrationPrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, bulkWithProrationConfig=$bulkWithProrationConfig, additionalProperties=$additionalProperties}" + "GroupedTieredPackagePrice{metadata=$metadata, id=$id, name=$name, externalPriceId=$externalPriceId, priceType=$priceType, modelType=$modelType, createdAt=$createdAt, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, billableMetric=$billableMetric, fixedPriceQuantity=$fixedPriceQuantity, planPhaseOrder=$planPhaseOrder, currency=$currency, conversionRate=$conversionRate, item=$item, creditAllocation=$creditAllocation, discount=$discount, minimum=$minimum, minimumAmount=$minimumAmount, maximum=$maximum, maximumAmount=$maximumAmount, groupedTieredPackageConfig=$groupedTieredPackageConfig, additionalProperties=$additionalProperties}" } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt index 3925dae64..5fcfea214 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt @@ -57,6 +57,7 @@ constructor( NewFloatingGroupedWithMeteredMinimumPrice?, private val newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice?, private val newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice?, + private val newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice?, private val additionalHeaders: Map>, private val additionalQueryParams: Map>, ) { @@ -133,6 +134,9 @@ constructor( fun newFloatingBulkWithProrationPrice(): Optional = Optional.ofNullable(newFloatingBulkWithProrationPrice) + fun newFloatingGroupedTieredPackagePrice(): Optional = + Optional.ofNullable(newFloatingGroupedTieredPackagePrice) + @JvmSynthetic internal fun getBody(): PriceCreateBody { return PriceCreateBody( @@ -159,6 +163,7 @@ constructor( newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, + newFloatingGroupedTieredPackagePrice, ) } @@ -204,6 +209,8 @@ constructor( private val newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice? = null, private val newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice? = null, + private val newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice? = + null, private val _json: JsonValue? = null, ) { @@ -281,6 +288,9 @@ constructor( fun newFloatingBulkWithProrationPrice(): Optional = Optional.ofNullable(newFloatingBulkWithProrationPrice) + fun newFloatingGroupedTieredPackagePrice(): Optional = + Optional.ofNullable(newFloatingGroupedTieredPackagePrice) + fun isNewFloatingUnitPrice(): Boolean = newFloatingUnitPrice != null fun isNewFloatingPackagePrice(): Boolean = newFloatingPackagePrice != null @@ -339,6 +349,9 @@ constructor( fun isNewFloatingBulkWithProrationPrice(): Boolean = newFloatingBulkWithProrationPrice != null + fun isNewFloatingGroupedTieredPackagePrice(): Boolean = + newFloatingGroupedTieredPackagePrice != null + fun asNewFloatingUnitPrice(): NewFloatingUnitPrice = newFloatingUnitPrice.getOrThrow("newFloatingUnitPrice") @@ -420,6 +433,9 @@ constructor( fun asNewFloatingBulkWithProrationPrice(): NewFloatingBulkWithProrationPrice = newFloatingBulkWithProrationPrice.getOrThrow("newFloatingBulkWithProrationPrice") + fun asNewFloatingGroupedTieredPackagePrice(): NewFloatingGroupedTieredPackagePrice = + newFloatingGroupedTieredPackagePrice.getOrThrow("newFloatingGroupedTieredPackagePrice") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T { @@ -493,6 +509,10 @@ constructor( visitor.visitNewFloatingBulkWithProrationPrice( newFloatingBulkWithProrationPrice ) + newFloatingGroupedTieredPackagePrice != null -> + visitor.visitNewFloatingGroupedTieredPackagePrice( + newFloatingGroupedTieredPackagePrice + ) else -> visitor.unknown(_json) } } @@ -502,11 +522,11 @@ constructor( return true } - return /* spotless:off */ other is PriceCreateBody && this.newFloatingUnitPrice == other.newFloatingUnitPrice && this.newFloatingPackagePrice == other.newFloatingPackagePrice && this.newFloatingMatrixPrice == other.newFloatingMatrixPrice && this.newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && this.newFloatingTieredPrice == other.newFloatingTieredPrice && this.newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && this.newFloatingBpsPrice == other.newFloatingBpsPrice && this.newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && this.newFloatingBulkPrice == other.newFloatingBulkPrice && this.newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && this.newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && this.newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && this.newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && this.newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && this.newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && this.newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && this.newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && this.newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && this.newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && this.newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && this.newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && this.newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && this.newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice /* spotless:on */ + return /* spotless:off */ other is PriceCreateBody && this.newFloatingUnitPrice == other.newFloatingUnitPrice && this.newFloatingPackagePrice == other.newFloatingPackagePrice && this.newFloatingMatrixPrice == other.newFloatingMatrixPrice && this.newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && this.newFloatingTieredPrice == other.newFloatingTieredPrice && this.newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && this.newFloatingBpsPrice == other.newFloatingBpsPrice && this.newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && this.newFloatingBulkPrice == other.newFloatingBulkPrice && this.newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && this.newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && this.newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && this.newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && this.newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && this.newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && this.newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && this.newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && this.newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && this.newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && this.newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && this.newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && this.newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && this.newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice && this.newFloatingGroupedTieredPackagePrice == other.newFloatingGroupedTieredPackagePrice /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice) /* spotless:on */ + return /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, newFloatingGroupedTieredPackagePrice) /* spotless:on */ } override fun toString(): String { @@ -557,6 +577,8 @@ constructor( "PriceCreateBody{newFloatingMatrixWithDisplayNamePrice=$newFloatingMatrixWithDisplayNamePrice}" newFloatingBulkWithProrationPrice != null -> "PriceCreateBody{newFloatingBulkWithProrationPrice=$newFloatingBulkWithProrationPrice}" + newFloatingGroupedTieredPackagePrice != null -> + "PriceCreateBody{newFloatingGroupedTieredPackagePrice=$newFloatingGroupedTieredPackagePrice}" _json != null -> "PriceCreateBody{_unknown=$_json}" else -> throw IllegalStateException("Invalid PriceCreateBody") } @@ -710,6 +732,14 @@ constructor( PriceCreateBody( newFloatingBulkWithProrationPrice = newFloatingBulkWithProrationPrice ) + + @JvmStatic + fun ofNewFloatingGroupedTieredPackagePrice( + newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice + ) = + PriceCreateBody( + newFloatingGroupedTieredPackagePrice = newFloatingGroupedTieredPackagePrice + ) } interface Visitor { @@ -793,6 +823,10 @@ constructor( newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice ): T + fun visitNewFloatingGroupedTieredPackagePrice( + newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice + ): T + fun unknown(json: JsonValue?): T { throw OrbInvalidDataException("Unknown PriceCreateBody: $json") } @@ -988,6 +1022,15 @@ constructor( ) } } + "grouped_tiered_package" -> { + tryDeserialize(node, jacksonTypeRef()) + ?.let { + return PriceCreateBody( + newFloatingGroupedTieredPackagePrice = it, + _json = json + ) + } + } } return PriceCreateBody(_json = json) @@ -1048,6 +1091,8 @@ constructor( generator.writeObject(value.newFloatingMatrixWithDisplayNamePrice) value.newFloatingBulkWithProrationPrice != null -> generator.writeObject(value.newFloatingBulkWithProrationPrice) + value.newFloatingGroupedTieredPackagePrice != null -> + generator.writeObject(value.newFloatingGroupedTieredPackagePrice) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid PriceCreateBody") } @@ -1064,15 +1109,15 @@ constructor( return true } - return /* spotless:off */ other is PriceCreateParams && this.newFloatingUnitPrice == other.newFloatingUnitPrice && this.newFloatingPackagePrice == other.newFloatingPackagePrice && this.newFloatingMatrixPrice == other.newFloatingMatrixPrice && this.newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && this.newFloatingTieredPrice == other.newFloatingTieredPrice && this.newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && this.newFloatingBpsPrice == other.newFloatingBpsPrice && this.newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && this.newFloatingBulkPrice == other.newFloatingBulkPrice && this.newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && this.newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && this.newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && this.newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && this.newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && this.newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && this.newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && this.newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && this.newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && this.newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && this.newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && this.newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && this.newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && this.newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is PriceCreateParams && this.newFloatingUnitPrice == other.newFloatingUnitPrice && this.newFloatingPackagePrice == other.newFloatingPackagePrice && this.newFloatingMatrixPrice == other.newFloatingMatrixPrice && this.newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && this.newFloatingTieredPrice == other.newFloatingTieredPrice && this.newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && this.newFloatingBpsPrice == other.newFloatingBpsPrice && this.newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && this.newFloatingBulkPrice == other.newFloatingBulkPrice && this.newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && this.newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && this.newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && this.newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && this.newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && this.newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && this.newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && this.newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && this.newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && this.newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && this.newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && this.newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && this.newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && this.newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice && this.newFloatingGroupedTieredPackagePrice == other.newFloatingGroupedTieredPackagePrice && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, additionalHeaders, additionalQueryParams) /* spotless:on */ + return /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, newFloatingGroupedTieredPackagePrice, additionalHeaders, additionalQueryParams) /* spotless:on */ } override fun toString() = - "PriceCreateParams{newFloatingUnitPrice=$newFloatingUnitPrice, newFloatingPackagePrice=$newFloatingPackagePrice, newFloatingMatrixPrice=$newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice=$newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice=$newFloatingTieredPrice, newFloatingTieredBpsPrice=$newFloatingTieredBpsPrice, newFloatingBpsPrice=$newFloatingBpsPrice, newFloatingBulkBpsPrice=$newFloatingBulkBpsPrice, newFloatingBulkPrice=$newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice=$newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice=$newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice=$newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice=$newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice=$newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice=$newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice=$newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice=$newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice=$newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice=$newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice=$newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice=$newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice=$newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice=$newFloatingBulkWithProrationPrice, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "PriceCreateParams{newFloatingUnitPrice=$newFloatingUnitPrice, newFloatingPackagePrice=$newFloatingPackagePrice, newFloatingMatrixPrice=$newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice=$newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice=$newFloatingTieredPrice, newFloatingTieredBpsPrice=$newFloatingTieredBpsPrice, newFloatingBpsPrice=$newFloatingBpsPrice, newFloatingBulkBpsPrice=$newFloatingBulkBpsPrice, newFloatingBulkPrice=$newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice=$newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice=$newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice=$newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice=$newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice=$newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice=$newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice=$newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice=$newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice=$newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice=$newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice=$newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice=$newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice=$newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice=$newFloatingBulkWithProrationPrice, newFloatingGroupedTieredPackagePrice=$newFloatingGroupedTieredPackagePrice, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" fun toBuilder() = Builder().from(this) @@ -1117,6 +1162,8 @@ constructor( private var newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice? = null private var newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice? = null + private var newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice? = + null private var additionalHeaders: ListMultimap = ArrayListMultimap.create() private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() @@ -1157,6 +1204,8 @@ constructor( priceCreateParams.newFloatingMatrixWithDisplayNamePrice this.newFloatingBulkWithProrationPrice = priceCreateParams.newFloatingBulkWithProrationPrice + this.newFloatingGroupedTieredPackagePrice = + priceCreateParams.newFloatingGroupedTieredPackagePrice additionalHeaders(priceCreateParams.additionalHeaders) additionalQueryParams(priceCreateParams.additionalQueryParams) } @@ -1185,6 +1234,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingPackagePrice(newFloatingPackagePrice: NewFloatingPackagePrice) = apply { @@ -1211,6 +1261,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingMatrixPrice(newFloatingMatrixPrice: NewFloatingMatrixPrice) = apply { @@ -1237,6 +1288,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingMatrixWithAllocationPrice( @@ -1265,6 +1317,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingTieredPrice(newFloatingTieredPrice: NewFloatingTieredPrice) = apply { @@ -1291,6 +1344,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingTieredBpsPrice(newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice) = @@ -1318,6 +1372,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingBpsPrice(newFloatingBpsPrice: NewFloatingBpsPrice) = apply { @@ -1344,6 +1399,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice) = apply { @@ -1370,6 +1426,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingBulkPrice(newFloatingBulkPrice: NewFloatingBulkPrice) = apply { @@ -1396,6 +1453,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingThresholdTotalAmountPrice( @@ -1424,6 +1482,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingTieredPackagePrice( @@ -1452,6 +1511,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingGroupedTieredPrice( @@ -1480,6 +1540,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingTieredWithMinimumPrice( @@ -1508,6 +1569,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingPackageWithAllocationPrice( @@ -1536,6 +1598,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingTieredPackageWithMinimumPrice( @@ -1564,6 +1627,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingUnitWithPercentPrice( @@ -1592,6 +1656,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingTieredWithProrationPrice( @@ -1620,6 +1685,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingUnitWithProrationPrice( @@ -1648,6 +1714,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingGroupedAllocationPrice( @@ -1676,6 +1743,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingGroupedWithProratedMinimumPrice( @@ -1705,6 +1773,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingGroupedWithMeteredMinimumPrice( @@ -1734,6 +1803,7 @@ constructor( newFloatingGroupedWithMeteredMinimumPrice this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingMatrixWithDisplayNamePrice( @@ -1762,6 +1832,7 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = newFloatingMatrixWithDisplayNamePrice this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = null } fun forNewFloatingBulkWithProrationPrice( @@ -1790,6 +1861,36 @@ constructor( this.newFloatingGroupedWithMeteredMinimumPrice = null this.newFloatingMatrixWithDisplayNamePrice = null this.newFloatingBulkWithProrationPrice = newFloatingBulkWithProrationPrice + this.newFloatingGroupedTieredPackagePrice = null + } + + fun forNewFloatingGroupedTieredPackagePrice( + newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice + ) = apply { + this.newFloatingUnitPrice = null + this.newFloatingPackagePrice = null + this.newFloatingMatrixPrice = null + this.newFloatingMatrixWithAllocationPrice = null + this.newFloatingTieredPrice = null + this.newFloatingTieredBpsPrice = null + this.newFloatingBpsPrice = null + this.newFloatingBulkBpsPrice = null + this.newFloatingBulkPrice = null + this.newFloatingThresholdTotalAmountPrice = null + this.newFloatingTieredPackagePrice = null + this.newFloatingGroupedTieredPrice = null + this.newFloatingTieredWithMinimumPrice = null + this.newFloatingPackageWithAllocationPrice = null + this.newFloatingTieredPackageWithMinimumPrice = null + this.newFloatingUnitWithPercentPrice = null + this.newFloatingTieredWithProrationPrice = null + this.newFloatingUnitWithProrationPrice = null + this.newFloatingGroupedAllocationPrice = null + this.newFloatingGroupedWithProratedMinimumPrice = null + this.newFloatingGroupedWithMeteredMinimumPrice = null + this.newFloatingMatrixWithDisplayNamePrice = null + this.newFloatingBulkWithProrationPrice = null + this.newFloatingGroupedTieredPackagePrice = newFloatingGroupedTieredPackagePrice } fun additionalHeaders(additionalHeaders: Map>) = apply { @@ -1891,6 +1992,7 @@ constructor( newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, + newFloatingGroupedTieredPackagePrice, additionalHeaders .asMap() .mapValues { it.value.toList().toImmutable() } @@ -22466,4 +22568,864 @@ constructor( override fun toString() = "NewFloatingBulkWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkWithProrationConfig=$bulkWithProrationConfig, currency=$currency, additionalProperties=$additionalProperties}" } + + @JsonDeserialize(builder = NewFloatingGroupedTieredPackagePrice.Builder::class) + @NoAutoDetect + class NewFloatingGroupedTieredPackagePrice + private constructor( + private val metadata: Metadata?, + private val externalPriceId: String?, + private val name: String?, + private val billableMetricId: String?, + private val itemId: String?, + private val billedInAdvance: Boolean?, + private val fixedPriceQuantity: Double?, + private val invoiceGroupingKey: String?, + private val cadence: Cadence?, + private val billingCycleConfiguration: BillingCycleConfiguration?, + private val invoicingCycleConfiguration: InvoicingCycleConfiguration?, + private val conversionRate: Double?, + private val modelType: ModelType?, + private val groupedTieredPackageConfig: GroupedTieredPackageConfig?, + private val currency: String?, + private val additionalProperties: Map, + ) { + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by setting + * `metadata` to `null`. + */ + @JsonProperty("metadata") fun metadata(): Metadata? = metadata + + /** An alias for the price. */ + @JsonProperty("external_price_id") fun externalPriceId(): String? = externalPriceId + + /** The name of the price. */ + @JsonProperty("name") fun name(): String? = name + + /** The id of the billable metric for the price. Only needed if the price is usage-based. */ + @JsonProperty("billable_metric_id") fun billableMetricId(): String? = billableMetricId + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(): String? = itemId + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") fun billedInAdvance(): Boolean? = billedInAdvance + + /** If the Price represents a fixed cost, this represents the quantity of units applied. */ + @JsonProperty("fixed_price_quantity") fun fixedPriceQuantity(): Double? = fixedPriceQuantity + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") fun invoiceGroupingKey(): String? = invoiceGroupingKey + + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") fun cadence(): Cadence? = cadence + + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(): BillingCycleConfiguration? = billingCycleConfiguration + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + fun invoicingCycleConfiguration(): InvoicingCycleConfiguration? = + invoicingCycleConfiguration + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") fun conversionRate(): Double? = conversionRate + + @JsonProperty("model_type") fun modelType(): ModelType? = modelType + + @JsonProperty("grouped_tiered_package_config") + fun groupedTieredPackageConfig(): GroupedTieredPackageConfig? = groupedTieredPackageConfig + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") fun currency(): String? = currency + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var metadata: Metadata? = null + private var externalPriceId: String? = null + private var name: String? = null + private var billableMetricId: String? = null + private var itemId: String? = null + private var billedInAdvance: Boolean? = null + private var fixedPriceQuantity: Double? = null + private var invoiceGroupingKey: String? = null + private var cadence: Cadence? = null + private var billingCycleConfiguration: BillingCycleConfiguration? = null + private var invoicingCycleConfiguration: InvoicingCycleConfiguration? = null + private var conversionRate: Double? = null + private var modelType: ModelType? = null + private var groupedTieredPackageConfig: GroupedTieredPackageConfig? = null + private var currency: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice + ) = apply { + this.metadata = newFloatingGroupedTieredPackagePrice.metadata + this.externalPriceId = newFloatingGroupedTieredPackagePrice.externalPriceId + this.name = newFloatingGroupedTieredPackagePrice.name + this.billableMetricId = newFloatingGroupedTieredPackagePrice.billableMetricId + this.itemId = newFloatingGroupedTieredPackagePrice.itemId + this.billedInAdvance = newFloatingGroupedTieredPackagePrice.billedInAdvance + this.fixedPriceQuantity = newFloatingGroupedTieredPackagePrice.fixedPriceQuantity + this.invoiceGroupingKey = newFloatingGroupedTieredPackagePrice.invoiceGroupingKey + this.cadence = newFloatingGroupedTieredPackagePrice.cadence + this.billingCycleConfiguration = + newFloatingGroupedTieredPackagePrice.billingCycleConfiguration + this.invoicingCycleConfiguration = + newFloatingGroupedTieredPackagePrice.invoicingCycleConfiguration + this.conversionRate = newFloatingGroupedTieredPackagePrice.conversionRate + this.modelType = newFloatingGroupedTieredPackagePrice.modelType + this.groupedTieredPackageConfig = + newFloatingGroupedTieredPackagePrice.groupedTieredPackageConfig + this.currency = newFloatingGroupedTieredPackagePrice.currency + additionalProperties(newFloatingGroupedTieredPackagePrice.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`. + */ + @JsonProperty("metadata") + fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + + /** An alias for the price. */ + @JsonProperty("external_price_id") + fun externalPriceId(externalPriceId: String) = apply { + this.externalPriceId = externalPriceId + } + + /** The name of the price. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + /** + * The id of the billable metric for the price. Only needed if the price is usage-based. + */ + @JsonProperty("billable_metric_id") + fun billableMetricId(billableMetricId: String) = apply { + this.billableMetricId = billableMetricId + } + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") fun itemId(itemId: String) = apply { this.itemId = itemId } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this is + * true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + fun billedInAdvance(billedInAdvance: Boolean) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units applied. + */ + @JsonProperty("fixed_price_quantity") + fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + fun invoiceGroupingKey(invoiceGroupingKey: String) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") + fun cadence(cadence: Cadence) = apply { this.cadence = cadence } + + /** + * For custom cadence: specifies the duration of the billing period in days or months. + */ + @JsonProperty("billing_cycle_configuration") + fun billingCycleConfiguration(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + this.billingCycleConfiguration = billingCycleConfiguration + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + fun conversionRate(conversionRate: Double) = apply { + this.conversionRate = conversionRate + } + + @JsonProperty("model_type") + fun modelType(modelType: ModelType) = apply { this.modelType = modelType } + + @JsonProperty("grouped_tiered_package_config") + fun groupedTieredPackageConfig(groupedTieredPackageConfig: GroupedTieredPackageConfig) = + apply { + this.groupedTieredPackageConfig = groupedTieredPackageConfig + } + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") + fun currency(currency: String) = apply { this.currency = currency } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): NewFloatingGroupedTieredPackagePrice = + NewFloatingGroupedTieredPackagePrice( + metadata, + externalPriceId, + checkNotNull(name) { "`name` is required but was not set" }, + billableMetricId, + checkNotNull(itemId) { "`itemId` is required but was not set" }, + billedInAdvance, + fixedPriceQuantity, + invoiceGroupingKey, + checkNotNull(cadence) { "`cadence` is required but was not set" }, + billingCycleConfiguration, + invoicingCycleConfiguration, + conversionRate, + checkNotNull(modelType) { "`modelType` is required but was not set" }, + checkNotNull(groupedTieredPackageConfig) { + "`groupedTieredPackageConfig` is required but was not set" + }, + checkNotNull(currency) { "`currency` is required but was not set" }, + additionalProperties.toImmutable(), + ) + } + + class Cadence + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Cadence && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val ANNUAL = Cadence(JsonField.of("annual")) + + @JvmField val SEMI_ANNUAL = Cadence(JsonField.of("semi_annual")) + + @JvmField val MONTHLY = Cadence(JsonField.of("monthly")) + + @JvmField val QUARTERLY = Cadence(JsonField.of("quarterly")) + + @JvmField val ONE_TIME = Cadence(JsonField.of("one_time")) + + @JvmField val CUSTOM = Cadence(JsonField.of("custom")) + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } + + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } + + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = GroupedTieredPackageConfig.Builder::class) + @NoAutoDetect + class GroupedTieredPackageConfig + private constructor( + private val additionalProperties: Map, + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(groupedTieredPackageConfig: GroupedTieredPackageConfig) = apply { + additionalProperties(groupedTieredPackageConfig.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): GroupedTieredPackageConfig = + GroupedTieredPackageConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is GroupedTieredPackageConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" + } + + class ModelType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ModelType && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField + val GROUPED_TIERED_PACKAGE = ModelType(JsonField.of("grouped_tiered_package")) + + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } + + enum class Known { + GROUPED_TIERED_PACKAGE, + } + + enum class Value { + GROUPED_TIERED_PACKAGE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + /** For custom cadence: specifies the duration of the billing period in days or months. */ + @JsonDeserialize(builder = BillingCycleConfiguration.Builder::class) + @NoAutoDetect + class BillingCycleConfiguration + private constructor( + private val duration: Long?, + private val durationUnit: DurationUnit?, + private val additionalProperties: Map, + ) { + + /** The duration of the billing period. */ + @JsonProperty("duration") fun duration(): Long? = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") fun durationUnit(): DurationUnit? = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: Long? = null + private var durationUnit: DurationUnit? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = apply { + this.duration = billingCycleConfiguration.duration + this.durationUnit = billingCycleConfiguration.durationUnit + additionalProperties(billingCycleConfiguration.additionalProperties) + } + + /** The duration of the billing period. */ + @JsonProperty("duration") + fun duration(duration: Long) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + fun durationUnit(durationUnit: DurationUnit) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + checkNotNull(duration) { "`duration` is required but was not set" }, + checkNotNull(durationUnit) { "`durationUnit` is required but was not set" }, + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val DAY = DurationUnit(JsonField.of("day")) + + @JvmField val MONTH = DurationUnit(JsonField.of("month")) + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BillingCycleConfiguration && this.duration == other.duration && this.durationUnit == other.durationUnit && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(duration, durationUnit, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. If + * unspecified, a single invoice is produced per billing cycle. + */ + @JsonDeserialize(builder = InvoicingCycleConfiguration.Builder::class) + @NoAutoDetect + class InvoicingCycleConfiguration + private constructor( + private val duration: Long?, + private val durationUnit: DurationUnit?, + private val additionalProperties: Map, + ) { + + /** The duration of the billing period. */ + @JsonProperty("duration") fun duration(): Long? = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") fun durationUnit(): DurationUnit? = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: Long? = null + private var durationUnit: DurationUnit? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoicingCycleConfiguration: InvoicingCycleConfiguration) = + apply { + this.duration = invoicingCycleConfiguration.duration + this.durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties(invoicingCycleConfiguration.additionalProperties) + } + + /** The duration of the billing period. */ + @JsonProperty("duration") + fun duration(duration: Long) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + fun durationUnit(durationUnit: DurationUnit) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + checkNotNull(duration) { "`duration` is required but was not set" }, + checkNotNull(durationUnit) { "`durationUnit` is required but was not set" }, + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val DAY = DurationUnit(JsonField.of("day")) + + @JvmField val MONTH = DurationUnit(JsonField.of("month")) + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InvoicingCycleConfiguration && this.duration == other.duration && this.durationUnit == other.durationUnit && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(duration, durationUnit, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by + * setting the value to `null`, and the entire metadata mapping can be cleared by setting + * `metadata` to `null`. + */ + @JsonDeserialize(builder = Metadata.Builder::class) + @NoAutoDetect + class Metadata + private constructor( + private val additionalProperties: Map, + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties(metadata.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is NewFloatingGroupedTieredPackagePrice && this.metadata == other.metadata && this.externalPriceId == other.externalPriceId && this.name == other.name && this.billableMetricId == other.billableMetricId && this.itemId == other.itemId && this.billedInAdvance == other.billedInAdvance && this.fixedPriceQuantity == other.fixedPriceQuantity && this.invoiceGroupingKey == other.invoiceGroupingKey && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.conversionRate == other.conversionRate && this.modelType == other.modelType && this.groupedTieredPackageConfig == other.groupedTieredPackageConfig && this.currency == other.currency && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedTieredPackageConfig, currency, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "NewFloatingGroupedTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedTieredPackageConfig=$groupedTieredPackageConfig, currency=$currency, additionalProperties=$additionalProperties}" + } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt index 4dad22c92..b2ca49de5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt @@ -1919,6 +1919,9 @@ constructor( null, private val newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice? = null, + private val newFloatingGroupedTieredPackagePrice: + NewFloatingGroupedTieredPackagePrice? = + null, private val _json: JsonValue? = null, ) { @@ -2001,6 +2004,10 @@ constructor( fun newFloatingBulkWithProrationPrice(): Optional = Optional.ofNullable(newFloatingBulkWithProrationPrice) + fun newFloatingGroupedTieredPackagePrice(): + Optional = + Optional.ofNullable(newFloatingGroupedTieredPackagePrice) + fun isNewFloatingUnitPrice(): Boolean = newFloatingUnitPrice != null fun isNewFloatingPackagePrice(): Boolean = newFloatingPackagePrice != null @@ -2060,6 +2067,9 @@ constructor( fun isNewFloatingBulkWithProrationPrice(): Boolean = newFloatingBulkWithProrationPrice != null + fun isNewFloatingGroupedTieredPackagePrice(): Boolean = + newFloatingGroupedTieredPackagePrice != null + fun asNewFloatingUnitPrice(): NewFloatingUnitPrice = newFloatingUnitPrice.getOrThrow("newFloatingUnitPrice") @@ -2148,6 +2158,11 @@ constructor( fun asNewFloatingBulkWithProrationPrice(): NewFloatingBulkWithProrationPrice = newFloatingBulkWithProrationPrice.getOrThrow("newFloatingBulkWithProrationPrice") + fun asNewFloatingGroupedTieredPackagePrice(): NewFloatingGroupedTieredPackagePrice = + newFloatingGroupedTieredPackagePrice.getOrThrow( + "newFloatingGroupedTieredPackagePrice" + ) + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T { @@ -2224,6 +2239,10 @@ constructor( visitor.visitNewFloatingBulkWithProrationPrice( newFloatingBulkWithProrationPrice ) + newFloatingGroupedTieredPackagePrice != null -> + visitor.visitNewFloatingGroupedTieredPackagePrice( + newFloatingGroupedTieredPackagePrice + ) else -> visitor.unknown(_json) } } @@ -2253,7 +2272,8 @@ constructor( newFloatingGroupedWithProratedMinimumPrice == null && newFloatingGroupedWithMeteredMinimumPrice == null && newFloatingMatrixWithDisplayNamePrice == null && - newFloatingBulkWithProrationPrice == null + newFloatingBulkWithProrationPrice == null && + newFloatingGroupedTieredPackagePrice == null ) { throw OrbInvalidDataException("Unknown Price: $_json") } @@ -2280,6 +2300,7 @@ constructor( newFloatingGroupedWithMeteredMinimumPrice?.validate() newFloatingMatrixWithDisplayNamePrice?.validate() newFloatingBulkWithProrationPrice?.validate() + newFloatingGroupedTieredPackagePrice?.validate() validated = true } } @@ -2289,11 +2310,11 @@ constructor( return true } - return /* spotless:off */ other is Price && this.newFloatingUnitPrice == other.newFloatingUnitPrice && this.newFloatingPackagePrice == other.newFloatingPackagePrice && this.newFloatingMatrixPrice == other.newFloatingMatrixPrice && this.newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && this.newFloatingTieredPrice == other.newFloatingTieredPrice && this.newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && this.newFloatingBpsPrice == other.newFloatingBpsPrice && this.newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && this.newFloatingBulkPrice == other.newFloatingBulkPrice && this.newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && this.newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && this.newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && this.newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && this.newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && this.newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && this.newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && this.newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && this.newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && this.newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && this.newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && this.newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && this.newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && this.newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice /* spotless:on */ + return /* spotless:off */ other is Price && this.newFloatingUnitPrice == other.newFloatingUnitPrice && this.newFloatingPackagePrice == other.newFloatingPackagePrice && this.newFloatingMatrixPrice == other.newFloatingMatrixPrice && this.newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && this.newFloatingTieredPrice == other.newFloatingTieredPrice && this.newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && this.newFloatingBpsPrice == other.newFloatingBpsPrice && this.newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && this.newFloatingBulkPrice == other.newFloatingBulkPrice && this.newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && this.newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && this.newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && this.newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && this.newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && this.newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && this.newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && this.newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && this.newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && this.newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && this.newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && this.newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && this.newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && this.newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice && this.newFloatingGroupedTieredPackagePrice == other.newFloatingGroupedTieredPackagePrice /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice) /* spotless:on */ + return /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, newFloatingGroupedTieredPackagePrice) /* spotless:on */ } override fun toString(): String { @@ -2343,6 +2364,8 @@ constructor( "Price{newFloatingMatrixWithDisplayNamePrice=$newFloatingMatrixWithDisplayNamePrice}" newFloatingBulkWithProrationPrice != null -> "Price{newFloatingBulkWithProrationPrice=$newFloatingBulkWithProrationPrice}" + newFloatingGroupedTieredPackagePrice != null -> + "Price{newFloatingGroupedTieredPackagePrice=$newFloatingGroupedTieredPackagePrice}" _json != null -> "Price{_unknown=$_json}" else -> throw IllegalStateException("Invalid Price") } @@ -2486,6 +2509,14 @@ constructor( fun ofNewFloatingBulkWithProrationPrice( newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice ) = Price(newFloatingBulkWithProrationPrice = newFloatingBulkWithProrationPrice) + + @JvmStatic + fun ofNewFloatingGroupedTieredPackagePrice( + newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice + ) = + Price( + newFloatingGroupedTieredPackagePrice = newFloatingGroupedTieredPackagePrice + ) } interface Visitor { @@ -2575,6 +2606,10 @@ constructor( newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice ): T + fun visitNewFloatingGroupedTieredPackagePrice( + newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice + ): T + fun unknown(json: JsonValue?): T { throw OrbInvalidDataException("Unknown Price: $json") } @@ -2847,6 +2882,20 @@ constructor( ) } } + "grouped_tiered_package" -> { + tryDeserialize( + node, + jacksonTypeRef() + ) { + it.validate() + } + ?.let { + return Price( + newFloatingGroupedTieredPackagePrice = it, + _json = json + ) + } + } } return Price(_json = json) @@ -2907,6 +2956,8 @@ constructor( generator.writeObject(value.newFloatingMatrixWithDisplayNamePrice) value.newFloatingBulkWithProrationPrice != null -> generator.writeObject(value.newFloatingBulkWithProrationPrice) + value.newFloatingGroupedTieredPackagePrice != null -> + generator.writeObject(value.newFloatingGroupedTieredPackagePrice) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Price") } @@ -31127,6 +31178,1183 @@ constructor( override fun toString() = "NewFloatingBulkWithProrationPrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, bulkWithProrationConfig=$bulkWithProrationConfig, currency=$currency, additionalProperties=$additionalProperties}" } + + @JsonDeserialize(builder = NewFloatingGroupedTieredPackagePrice.Builder::class) + @NoAutoDetect + class NewFloatingGroupedTieredPackagePrice + private constructor( + private val metadata: JsonField, + private val externalPriceId: JsonField, + private val name: JsonField, + private val billableMetricId: JsonField, + private val itemId: JsonField, + private val billedInAdvance: JsonField, + private val fixedPriceQuantity: JsonField, + private val invoiceGroupingKey: JsonField, + private val cadence: JsonField, + private val billingCycleConfiguration: JsonField, + private val invoicingCycleConfiguration: JsonField, + private val conversionRate: JsonField, + private val modelType: JsonField, + private val groupedTieredPackageConfig: JsonField, + private val currency: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** An alias for the price. */ + fun externalPriceId(): Optional = + Optional.ofNullable(externalPriceId.getNullable("external_price_id")) + + /** The name of the price. */ + fun name(): String = name.getRequired("name") + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(): Optional = + Optional.ofNullable(billableMetricId.getNullable("billable_metric_id")) + + /** The id of the item the plan will be associated with. */ + fun itemId(): String = itemId.getRequired("item_id") + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + fun billedInAdvance(): Optional = + Optional.ofNullable(billedInAdvance.getNullable("billed_in_advance")) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(): Optional = + Optional.ofNullable(fixedPriceQuantity.getNullable("fixed_price_quantity")) + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(): Optional = + Optional.ofNullable(invoiceGroupingKey.getNullable("invoice_grouping_key")) + + /** The cadence to bill for this price on. */ + fun cadence(): Cadence = cadence.getRequired("cadence") + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration(): Optional = + Optional.ofNullable( + billingCycleConfiguration.getNullable("billing_cycle_configuration") + ) + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration(): Optional = + Optional.ofNullable( + invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration") + ) + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + fun conversionRate(): Optional = + Optional.ofNullable(conversionRate.getNullable("conversion_rate")) + + fun modelType(): ModelType = modelType.getRequired("model_type") + + fun groupedTieredPackageConfig(): GroupedTieredPackageConfig = + groupedTieredPackageConfig.getRequired("grouped_tiered_package_config") + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(): String = currency.getRequired("currency") + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata + + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId() = externalPriceId + + /** The name of the price. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun _billableMetricId() = billableMetricId + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if this + * is true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun _billedInAdvance() = billedInAdvance + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun _fixedPriceQuantity() = fixedPriceQuantity + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun _invoiceGroupingKey() = invoiceGroupingKey + + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") @ExcludeMissing fun _cadence() = cadence + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun _billingCycleConfiguration() = billingCycleConfiguration + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun _invoicingCycleConfiguration() = invoicingCycleConfiguration + + /** The per unit conversion rate of the price currency to the invoicing currency. */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun _conversionRate() = conversionRate + + @JsonProperty("model_type") @ExcludeMissing fun _modelType() = modelType + + @JsonProperty("grouped_tiered_package_config") + @ExcludeMissing + fun _groupedTieredPackageConfig() = groupedTieredPackageConfig + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): NewFloatingGroupedTieredPackagePrice = apply { + if (!validated) { + metadata().map { it.validate() } + externalPriceId() + name() + billableMetricId() + itemId() + billedInAdvance() + fixedPriceQuantity() + invoiceGroupingKey() + cadence() + billingCycleConfiguration().map { it.validate() } + invoicingCycleConfiguration().map { it.validate() } + conversionRate() + modelType() + groupedTieredPackageConfig().validate() + currency() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var metadata: JsonField = JsonMissing.of() + private var externalPriceId: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var billableMetricId: JsonField = JsonMissing.of() + private var itemId: JsonField = JsonMissing.of() + private var billedInAdvance: JsonField = JsonMissing.of() + private var fixedPriceQuantity: JsonField = JsonMissing.of() + private var invoiceGroupingKey: JsonField = JsonMissing.of() + private var cadence: JsonField = JsonMissing.of() + private var billingCycleConfiguration: JsonField = + JsonMissing.of() + private var invoicingCycleConfiguration: + JsonField = + JsonMissing.of() + private var conversionRate: JsonField = JsonMissing.of() + private var modelType: JsonField = JsonMissing.of() + private var groupedTieredPackageConfig: JsonField = + JsonMissing.of() + private var currency: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice + ) = apply { + this.metadata = newFloatingGroupedTieredPackagePrice.metadata + this.externalPriceId = newFloatingGroupedTieredPackagePrice.externalPriceId + this.name = newFloatingGroupedTieredPackagePrice.name + this.billableMetricId = + newFloatingGroupedTieredPackagePrice.billableMetricId + this.itemId = newFloatingGroupedTieredPackagePrice.itemId + this.billedInAdvance = newFloatingGroupedTieredPackagePrice.billedInAdvance + this.fixedPriceQuantity = + newFloatingGroupedTieredPackagePrice.fixedPriceQuantity + this.invoiceGroupingKey = + newFloatingGroupedTieredPackagePrice.invoiceGroupingKey + this.cadence = newFloatingGroupedTieredPackagePrice.cadence + this.billingCycleConfiguration = + newFloatingGroupedTieredPackagePrice.billingCycleConfiguration + this.invoicingCycleConfiguration = + newFloatingGroupedTieredPackagePrice.invoicingCycleConfiguration + this.conversionRate = newFloatingGroupedTieredPackagePrice.conversionRate + this.modelType = newFloatingGroupedTieredPackagePrice.modelType + this.groupedTieredPackageConfig = + newFloatingGroupedTieredPackagePrice.groupedTieredPackageConfig + this.currency = newFloatingGroupedTieredPackagePrice.currency + additionalProperties( + newFloatingGroupedTieredPackagePrice.additionalProperties + ) + } + + /** + * User-specified key/value pairs for the resource. Individual keys can be + * removed by setting the value to `null`, and the entire metadata mapping can + * be cleared by setting `metadata` to `null`. + */ + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + + /** + * User-specified key/value pairs for the resource. Individual keys can be + * removed by setting the value to `null`, and the entire metadata mapping can + * be cleared by setting `metadata` to `null`. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** An alias for the price. */ + fun externalPriceId(externalPriceId: String) = + externalPriceId(JsonField.of(externalPriceId)) + + /** An alias for the price. */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } + + /** The name of the price. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The name of the price. */ + @JsonProperty("name") + @ExcludeMissing + fun name(name: JsonField) = apply { this.name = name } + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + fun billableMetricId(billableMetricId: String) = + billableMetricId(JsonField.of(billableMetricId)) + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + @JsonProperty("billable_metric_id") + @ExcludeMissing + fun billableMetricId(billableMetricId: JsonField) = apply { + this.billableMetricId = billableMetricId + } + + /** The id of the item the plan will be associated with. */ + fun itemId(itemId: String) = itemId(JsonField.of(itemId)) + + /** The id of the item the plan will be associated with. */ + @JsonProperty("item_id") + @ExcludeMissing + fun itemId(itemId: JsonField) = apply { this.itemId = itemId } + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + fun billedInAdvance(billedInAdvance: Boolean) = + billedInAdvance(JsonField.of(billedInAdvance)) + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + @JsonProperty("billed_in_advance") + @ExcludeMissing + fun billedInAdvance(billedInAdvance: JsonField) = apply { + this.billedInAdvance = billedInAdvance + } + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fun fixedPriceQuantity(fixedPriceQuantity: Double) = + fixedPriceQuantity(JsonField.of(fixedPriceQuantity)) + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + @JsonProperty("fixed_price_quantity") + @ExcludeMissing + fun fixedPriceQuantity(fixedPriceQuantity: JsonField) = apply { + this.fixedPriceQuantity = fixedPriceQuantity + } + + /** The property used to group this price on an invoice */ + fun invoiceGroupingKey(invoiceGroupingKey: String) = + invoiceGroupingKey(JsonField.of(invoiceGroupingKey)) + + /** The property used to group this price on an invoice */ + @JsonProperty("invoice_grouping_key") + @ExcludeMissing + fun invoiceGroupingKey(invoiceGroupingKey: JsonField) = apply { + this.invoiceGroupingKey = invoiceGroupingKey + } + + /** The cadence to bill for this price on. */ + fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence)) + + /** The cadence to bill for this price on. */ + @JsonProperty("cadence") + @ExcludeMissing + fun cadence(cadence: JsonField) = apply { this.cadence = cadence } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + fun billingCycleConfiguration( + billingCycleConfiguration: BillingCycleConfiguration + ) = billingCycleConfiguration(JsonField.of(billingCycleConfiguration)) + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonProperty("billing_cycle_configuration") + @ExcludeMissing + fun billingCycleConfiguration( + billingCycleConfiguration: JsonField + ) = apply { this.billingCycleConfiguration = billingCycleConfiguration } + + /** + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. + */ + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = invoicingCycleConfiguration(JsonField.of(invoicingCycleConfiguration)) + + /** + * Within each billing cycle, specifies the cadence at which invoices are + * produced. If unspecified, a single invoice is produced per billing cycle. + */ + @JsonProperty("invoicing_cycle_configuration") + @ExcludeMissing + fun invoicingCycleConfiguration( + invoicingCycleConfiguration: JsonField + ) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration } + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + fun conversionRate(conversionRate: Double) = + conversionRate(JsonField.of(conversionRate)) + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + @JsonProperty("conversion_rate") + @ExcludeMissing + fun conversionRate(conversionRate: JsonField) = apply { + this.conversionRate = conversionRate + } + + fun modelType(modelType: ModelType) = modelType(JsonField.of(modelType)) + + @JsonProperty("model_type") + @ExcludeMissing + fun modelType(modelType: JsonField) = apply { + this.modelType = modelType + } + + fun groupedTieredPackageConfig( + groupedTieredPackageConfig: GroupedTieredPackageConfig + ) = groupedTieredPackageConfig(JsonField.of(groupedTieredPackageConfig)) + + @JsonProperty("grouped_tiered_package_config") + @ExcludeMissing + fun groupedTieredPackageConfig( + groupedTieredPackageConfig: JsonField + ) = apply { this.groupedTieredPackageConfig = groupedTieredPackageConfig } + + /** An ISO 4217 currency string for which this price is billed in. */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** An ISO 4217 currency string for which this price is billed in. */ + @JsonProperty("currency") + @ExcludeMissing + fun currency(currency: JsonField) = apply { this.currency = currency } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): NewFloatingGroupedTieredPackagePrice = + NewFloatingGroupedTieredPackagePrice( + metadata, + externalPriceId, + name, + billableMetricId, + itemId, + billedInAdvance, + fixedPriceQuantity, + invoiceGroupingKey, + cadence, + billingCycleConfiguration, + invoicingCycleConfiguration, + conversionRate, + modelType, + groupedTieredPackageConfig, + currency, + additionalProperties.toImmutable(), + ) + } + + class Cadence + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Cadence && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val ANNUAL = Cadence(JsonField.of("annual")) + + @JvmField val SEMI_ANNUAL = Cadence(JsonField.of("semi_annual")) + + @JvmField val MONTHLY = Cadence(JsonField.of("monthly")) + + @JvmField val QUARTERLY = Cadence(JsonField.of("quarterly")) + + @JvmField val ONE_TIME = Cadence(JsonField.of("one_time")) + + @JvmField val CUSTOM = Cadence(JsonField.of("custom")) + + @JvmStatic fun of(value: String) = Cadence(JsonField.of(value)) + } + + enum class Known { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + } + + enum class Value { + ANNUAL, + SEMI_ANNUAL, + MONTHLY, + QUARTERLY, + ONE_TIME, + CUSTOM, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ANNUAL -> Value.ANNUAL + SEMI_ANNUAL -> Value.SEMI_ANNUAL + MONTHLY -> Value.MONTHLY + QUARTERLY -> Value.QUARTERLY + ONE_TIME -> Value.ONE_TIME + CUSTOM -> Value.CUSTOM + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ANNUAL -> Known.ANNUAL + SEMI_ANNUAL -> Known.SEMI_ANNUAL + MONTHLY -> Known.MONTHLY + QUARTERLY -> Known.QUARTERLY + ONE_TIME -> Known.ONE_TIME + CUSTOM -> Known.CUSTOM + else -> throw OrbInvalidDataException("Unknown Cadence: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + @JsonDeserialize(builder = GroupedTieredPackageConfig.Builder::class) + @NoAutoDetect + class GroupedTieredPackageConfig + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): GroupedTieredPackageConfig = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(groupedTieredPackageConfig: GroupedTieredPackageConfig) = + apply { + additionalProperties( + groupedTieredPackageConfig.additionalProperties + ) + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun build(): GroupedTieredPackageConfig = + GroupedTieredPackageConfig(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is GroupedTieredPackageConfig && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "GroupedTieredPackageConfig{additionalProperties=$additionalProperties}" + } + + class ModelType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ModelType && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField + val GROUPED_TIERED_PACKAGE = + ModelType(JsonField.of("grouped_tiered_package")) + + @JvmStatic fun of(value: String) = ModelType(JsonField.of(value)) + } + + enum class Known { + GROUPED_TIERED_PACKAGE, + } + + enum class Value { + GROUPED_TIERED_PACKAGE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + GROUPED_TIERED_PACKAGE -> Value.GROUPED_TIERED_PACKAGE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + GROUPED_TIERED_PACKAGE -> Known.GROUPED_TIERED_PACKAGE + else -> throw OrbInvalidDataException("Unknown ModelType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + @JsonDeserialize(builder = BillingCycleConfiguration.Builder::class) + @NoAutoDetect + class BillingCycleConfiguration + private constructor( + private val duration: JsonField, + private val durationUnit: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") @ExcludeMissing fun _duration() = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit() = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): BillingCycleConfiguration = apply { + if (!validated) { + duration() + durationUnit() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField = JsonMissing.of() + private var durationUnit: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(billingCycleConfiguration: BillingCycleConfiguration) = + apply { + this.duration = billingCycleConfiguration.duration + this.durationUnit = billingCycleConfiguration.durationUnit + additionalProperties(billingCycleConfiguration.additionalProperties) + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun build(): BillingCycleConfiguration = + BillingCycleConfiguration( + duration, + durationUnit, + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val DAY = DurationUnit(JsonField.of("day")) + + @JvmField val MONTH = DurationUnit(JsonField.of("month")) + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> + throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BillingCycleConfiguration && this.duration == other.duration && this.durationUnit == other.durationUnit && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(duration, durationUnit, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "BillingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + @JsonDeserialize(builder = InvoicingCycleConfiguration.Builder::class) + @NoAutoDetect + class InvoicingCycleConfiguration + private constructor( + private val duration: JsonField, + private val durationUnit: JsonField, + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + /** The duration of the billing period. */ + fun duration(): Long = duration.getRequired("duration") + + /** The unit of billing period duration. */ + fun durationUnit(): DurationUnit = durationUnit.getRequired("duration_unit") + + /** The duration of the billing period. */ + @JsonProperty("duration") @ExcludeMissing fun _duration() = duration + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun _durationUnit() = durationUnit + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): InvoicingCycleConfiguration = apply { + if (!validated) { + duration() + durationUnit() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var duration: JsonField = JsonMissing.of() + private var durationUnit: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from( + invoicingCycleConfiguration: InvoicingCycleConfiguration + ) = apply { + this.duration = invoicingCycleConfiguration.duration + this.durationUnit = invoicingCycleConfiguration.durationUnit + additionalProperties(invoicingCycleConfiguration.additionalProperties) + } + + /** The duration of the billing period. */ + fun duration(duration: Long) = duration(JsonField.of(duration)) + + /** The duration of the billing period. */ + @JsonProperty("duration") + @ExcludeMissing + fun duration(duration: JsonField) = apply { this.duration = duration } + + /** The unit of billing period duration. */ + fun durationUnit(durationUnit: DurationUnit) = + durationUnit(JsonField.of(durationUnit)) + + /** The unit of billing period duration. */ + @JsonProperty("duration_unit") + @ExcludeMissing + fun durationUnit(durationUnit: JsonField) = apply { + this.durationUnit = durationUnit + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun build(): InvoicingCycleConfiguration = + InvoicingCycleConfiguration( + duration, + durationUnit, + additionalProperties.toImmutable(), + ) + } + + class DurationUnit + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DurationUnit && this.value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val DAY = DurationUnit(JsonField.of("day")) + + @JvmField val MONTH = DurationUnit(JsonField.of("month")) + + @JvmStatic fun of(value: String) = DurationUnit(JsonField.of(value)) + } + + enum class Known { + DAY, + MONTH, + } + + enum class Value { + DAY, + MONTH, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + DAY -> Value.DAY + MONTH -> Value.MONTH + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + DAY -> Known.DAY + MONTH -> Known.MONTH + else -> + throw OrbInvalidDataException("Unknown DurationUnit: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InvoicingCycleConfiguration && this.duration == other.duration && this.durationUnit == other.durationUnit && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(duration, durationUnit, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "InvoicingCycleConfiguration{duration=$duration, durationUnit=$durationUnit, additionalProperties=$additionalProperties}" + } + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared by + * setting `metadata` to `null`. + */ + @JsonDeserialize(builder = Metadata.Builder::class) + @NoAutoDetect + class Metadata + private constructor( + private val additionalProperties: Map, + ) { + + private var validated: Boolean = false + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): Metadata = apply { + if (!validated) { + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties(metadata.additionalProperties) + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is NewFloatingGroupedTieredPackagePrice && this.metadata == other.metadata && this.externalPriceId == other.externalPriceId && this.name == other.name && this.billableMetricId == other.billableMetricId && this.itemId == other.itemId && this.billedInAdvance == other.billedInAdvance && this.fixedPriceQuantity == other.fixedPriceQuantity && this.invoiceGroupingKey == other.invoiceGroupingKey && this.cadence == other.cadence && this.billingCycleConfiguration == other.billingCycleConfiguration && this.invoicingCycleConfiguration == other.invoicingCycleConfiguration && this.conversionRate == other.conversionRate && this.modelType == other.modelType && this.groupedTieredPackageConfig == other.groupedTieredPackageConfig && this.currency == other.currency && this.additionalProperties == other.additionalProperties /* spotless:on */ + } + + private var hashCode: Int = 0 + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = /* spotless:off */ Objects.hash(metadata, externalPriceId, name, billableMetricId, itemId, billedInAdvance, fixedPriceQuantity, invoiceGroupingKey, cadence, billingCycleConfiguration, invoicingCycleConfiguration, conversionRate, modelType, groupedTieredPackageConfig, currency, additionalProperties) /* spotless:on */ + } + return hashCode + } + + override fun toString() = + "NewFloatingGroupedTieredPackagePrice{metadata=$metadata, externalPriceId=$externalPriceId, name=$name, billableMetricId=$billableMetricId, itemId=$itemId, billedInAdvance=$billedInAdvance, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, cadence=$cadence, billingCycleConfiguration=$billingCycleConfiguration, invoicingCycleConfiguration=$invoicingCycleConfiguration, conversionRate=$conversionRate, modelType=$modelType, groupedTieredPackageConfig=$groupedTieredPackageConfig, currency=$currency, additionalProperties=$additionalProperties}" + } } override fun equals(other: Any?): Boolean { From 35fc304fc95abcb14ea4c720983e9de75a1d2e58 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 21:24:16 +0000 Subject: [PATCH 3/3] release: 0.4.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ README.md | 6 +++--- build.gradle.kts | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6b7b74c5f..da59f99ea 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.0" + ".": "0.4.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c2e539184..211f3f657 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.4.0 (2024-11-06) + +Full Changelog: [v0.3.0...v0.4.0](https://github.com/orbcorp/orb-java/compare/v0.3.0...v0.4.0) + +### Features + +* **api:** api update ([#103](https://github.com/orbcorp/orb-java/issues/103)) ([7f8fb9d](https://github.com/orbcorp/orb-java/commit/7f8fb9d3cbc2d0a1a131b3bf07e6a858cb1765b1)) + + +### Chores + +* **internal:** version bump ([#100](https://github.com/orbcorp/orb-java/issues/100)) ([ad65284](https://github.com/orbcorp/orb-java/commit/ad652840c239be31c15c58da11a3e11b3b23db2e)) + ## 0.3.0 (2024-11-06) Full Changelog: [v0.2.0...v0.3.0](https://github.com/orbcorp/orb-java/compare/v0.2.0...v0.3.0) diff --git a/README.md b/README.md index 7c7c2fd64..b7ee90952 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.3.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.4.0) @@ -25,7 +25,7 @@ The REST API documentation can be foundĀ on [docs.withorb.com](https://docs.with ```kotlin -implementation("com.withorb.api:orb-java:0.3.0") +implementation("com.withorb.api:orb-java:0.4.0") ``` #### Maven @@ -34,7 +34,7 @@ implementation("com.withorb.api:orb-java:0.3.0") com.withorb.api orb-java - 0.3.0 + 0.4.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index bcbdd5e7b..150045e98 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "com.withorb.api" - version = "0.3.0" // x-release-please-version + version = "0.4.0" // x-release-please-version }